<!DOCTYPE html>

<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

<title>class ActiveResource::Base - Rails Framework Documentation</title>

<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
</script>

<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>


<body id="top" class="class">
<nav id="metadata">
  <nav id="home-section" class="section">
  <h3 class="section-header">
    <a href="../index.html">Home</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </h3>
</nav>


  <nav id="search-section" class="section project-section" class="initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <h3 class="section-header">
      <input type="text" name="search" placeholder="Search" id="search-field"
             title="Type to search, Up and Down to navigate, Enter to load">
    </h3>
  </form>

  <ul id="search-results" class="initially-hidden"></ul>
</nav>


  <div id="file-metadata">
    <nav id="file-list-section" class="section">
  <h3 class="section-header">Defined In</h3>
  <ul>
    <li>/usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb
  </ul>
</nav>

    
  </div>

  <div id="class-metadata">
    
    <nav id="parent-class-section" class="section">
  <h3 class="section-header">Parent</h3>
  
  <p class="link"><a href="../Object.html">Object</a>
  
</nav>

    <!-- Included Modules -->
<nav id="includes-section" class="section">
  <h3 class="section-header">Included Modules</h3>

  <ul class="link-list">
  
  
    <li><a class="include" href="CustomMethods.html">ActiveResource::CustomMethods</a>
  
  
  
    <li><a class="include" href="Observing.html">ActiveResource::Observing</a>
  
  
  
    <li><a class="include" href="Validations.html">ActiveResource::Validations</a>
  
  
  
    <li><a class="include" href="../ActiveModel/Conversion.html">ActiveModel::Conversion</a>
  
  
  
    <li><a class="include" href="../ActiveModel/Serializers/JSON.html">ActiveModel::Serializers::JSON</a>
  
  
  
    <li><a class="include" href="../ActiveModel/Serializers/Xml.html">ActiveModel::Serializers::Xml</a>
  
  
  </ul>
</nav>

    <!-- Method Quickref -->
<nav id="method-list-section" class="section">
  <h3 class="section-header">Methods</h3>

  <ul class="link-list">
    
    <li><a href="#method-c-all">::all</a>
    
    <li><a href="#method-c-auth_type">::auth_type</a>
    
    <li><a href="#method-c-auth_type-3D">::auth_type=</a>
    
    <li><a href="#method-c-build">::build</a>
    
    <li><a href="#method-c-collection_name">::collection_name</a>
    
    <li><a href="#method-c-collection_path">::collection_path</a>
    
    <li><a href="#method-c-connection">::connection</a>
    
    <li><a href="#method-c-create">::create</a>
    
    <li><a href="#method-c-delete">::delete</a>
    
    <li><a href="#method-c-element_name">::element_name</a>
    
    <li><a href="#method-c-element_path">::element_path</a>
    
    <li><a href="#method-c-exists-3F">::exists?</a>
    
    <li><a href="#method-c-find">::find</a>
    
    <li><a href="#method-c-first">::first</a>
    
    <li><a href="#method-c-format">::format</a>
    
    <li><a href="#method-c-format-3D">::format=</a>
    
    <li><a href="#method-c-headers">::headers</a>
    
    <li><a href="#method-c-known_attributes">::known_attributes</a>
    
    <li><a href="#method-c-last">::last</a>
    
    <li><a href="#method-c-logger">::logger</a>
    
    <li><a href="#method-c-new">::new</a>
    
    <li><a href="#method-c-new_element_path">::new_element_path</a>
    
    <li><a href="#method-c-password">::password</a>
    
    <li><a href="#method-c-password-3D">::password=</a>
    
    <li><a href="#method-c-prefix">::prefix</a>
    
    <li><a href="#method-c-prefix-3D">::prefix=</a>
    
    <li><a href="#method-c-prefix_source">::prefix_source</a>
    
    <li><a href="#method-c-primary_key">::primary_key</a>
    
    <li><a href="#method-c-proxy">::proxy</a>
    
    <li><a href="#method-c-proxy-3D">::proxy=</a>
    
    <li><a href="#method-c-schema">::schema</a>
    
    <li><a href="#method-c-schema-3D">::schema=</a>
    
    <li><a href="#method-c-set_prefix">::set_prefix</a>
    
    <li><a href="#method-c-site">::site</a>
    
    <li><a href="#method-c-site-3D">::site=</a>
    
    <li><a href="#method-c-ssl_options">::ssl_options</a>
    
    <li><a href="#method-c-ssl_options-3D">::ssl_options=</a>
    
    <li><a href="#method-c-timeout">::timeout</a>
    
    <li><a href="#method-c-timeout-3D">::timeout=</a>
    
    <li><a href="#method-c-user">::user</a>
    
    <li><a href="#method-c-user-3D">::user=</a>
    
    <li><a href="#method-i-3D-3D">#==</a>
    
    <li><a href="#method-i-clone">#clone</a>
    
    <li><a href="#method-i-collection_path">#collection_path</a>
    
    <li><a href="#method-i-connection">#connection</a>
    
    <li><a href="#method-i-create">#create</a>
    
    <li><a href="#method-i-destroy">#destroy</a>
    
    <li><a href="#method-i-dup">#dup</a>
    
    <li><a href="#method-i-element_path">#element_path</a>
    
    <li><a href="#method-i-encode">#encode</a>
    
    <li><a href="#method-i-eql-3F">#eql?</a>
    
    <li><a href="#method-i-exists-3F">#exists?</a>
    
    <li><a href="#method-i-hash">#hash</a>
    
    <li><a href="#method-i-id">#id</a>
    
    <li><a href="#method-i-id-3D">#id=</a>
    
    <li><a href="#method-i-id_from_response">#id_from_response</a>
    
    <li><a href="#method-i-known_attributes">#known_attributes</a>
    
    <li><a href="#method-i-load">#load</a>
    
    <li><a href="#method-i-load_attributes_from_response">#load_attributes_from_response</a>
    
    <li><a href="#method-i-new-3F">#new?</a>
    
    <li><a href="#method-i-new_element_path">#new_element_path</a>
    
    <li><a href="#method-i-new_record-3F">#new_record?</a>
    
    <li><a href="#method-i-persisted-3F">#persisted?</a>
    
    <li><a href="#method-i-reload">#reload</a>
    
    <li><a href="#method-i-respond_to-3F">#respond_to?</a>
    
    <li><a href="#method-i-respond_to_without_attributes-3F">#respond_to_without_attributes?</a>
    
    <li><a href="#method-i-save">#save</a>
    
    <li><a href="#method-i-save-21">#save!</a>
    
    <li><a href="#method-i-schema">#schema</a>
    
    <li><a href="#method-i-to_json">#to_json</a>
    
    <li><a href="#method-i-to_xml">#to_xml</a>
    
    <li><a href="#method-i-update">#update</a>
    
    <li><a href="#method-i-update_attribute">#update_attribute</a>
    
    <li><a href="#method-i-update_attributes">#update_attributes</a>
    
  </ul>
</nav>

  </div>

  <div id="project-metadata">
    <nav id="fileindex-section" class="section project-section">
  <h3 class="section-header">Pages</h3>

  <ul>
  
    <li class="file"><a href="..//usr/local/lib/ruby/gems/1_9_1/gems/actionmailer-3_2_7/MIT-LICENSE.html">MIT-LICENSE</a>
  
    <li class="file"><a href="..//usr/local/lib/ruby/gems/1_9_1/gems/actionmailer-3_2_7/README_rdoc.html">README</a>
  
    <li class="file"><a href="..//usr/local/lib/ruby/gems/1_9_1/gems/actionpack-3_2_7/MIT-LICENSE.html">MIT-LICENSE</a>
  
    <li class="file"><a href="..//usr/local/lib/ruby/gems/1_9_1/gems/actionpack-3_2_7/README_rdoc.html">README</a>
  
    <li class="file"><a href="..//usr/local/lib/ruby/gems/1_9_1/gems/activemodel-3_2_7/MIT-LICENSE.html">MIT-LICENSE</a>
  
    <li class="file"><a href="..//usr/local/lib/ruby/gems/1_9_1/gems/activemodel-3_2_7/README_rdoc.html">README</a>
  
    <li class="file"><a href="..//usr/local/lib/ruby/gems/1_9_1/gems/activerecord-3_2_7/README_rdoc.html">README</a>
  
    <li class="file"><a href="..//usr/local/lib/ruby/gems/1_9_1/gems/activeresource-3_2_7/README_rdoc.html">README</a>
  
    <li class="file"><a href="..//usr/local/lib/ruby/gems/1_9_1/gems/activesupport-3_2_7/README_rdoc.html">README</a>
  
    <li class="file"><a href="..//usr/local/lib/ruby/gems/1_9_1/gems/railties-3_2_7/README_rdoc.html">README</a>
  
    <li class="file"><a href="../README_rdoc.html">README</a>
  
  </ul>
</nav>

    <nav id="classindex-section" class="section project-section">
  <h3 class="section-header">Class and Module Index</h3>

  <ul class="link-list">
  
    <li><a href="../ActiveRecord.html">ActiveRecord</a>
  
    <li><a href="../ActiveRecord/ActiveRecordError.html">ActiveRecord::ActiveRecordError</a>
  
    <li><a href="../ActiveRecord/AdapterNotFound.html">ActiveRecord::AdapterNotFound</a>
  
    <li><a href="../ActiveRecord/AdapterNotSpecified.html">ActiveRecord::AdapterNotSpecified</a>
  
    <li><a href="../ActiveRecord/Aggregations.html">ActiveRecord::Aggregations</a>
  
    <li><a href="../ActiveRecord/Aggregations/ClassMethods.html">ActiveRecord::Aggregations::ClassMethods</a>
  
    <li><a href="../ActiveRecord/AssociationTypeMismatch.html">ActiveRecord::AssociationTypeMismatch</a>
  
    <li><a href="../ActiveRecord/Associations.html">ActiveRecord::Associations</a>
  
    <li><a href="../ActiveRecord/Associations/ClassMethods.html">ActiveRecord::Associations::ClassMethods</a>
  
    <li><a href="../ActiveRecord/AttributeAssignment.html">ActiveRecord::AttributeAssignment</a>
  
    <li><a href="../ActiveRecord/AttributeAssignment/ClassMethods.html">ActiveRecord::AttributeAssignment::ClassMethods</a>
  
    <li><a href="../ActiveRecord/AttributeAssignmentError.html">ActiveRecord::AttributeAssignmentError</a>
  
    <li><a href="../ActiveRecord/AttributeMethods.html">ActiveRecord::AttributeMethods</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/BeforeTypeCast.html">ActiveRecord::AttributeMethods::BeforeTypeCast</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/ClassMethods.html">ActiveRecord::AttributeMethods::ClassMethods</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/DeprecatedUnderscoreRead.html">ActiveRecord::AttributeMethods::DeprecatedUnderscoreRead</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/DeprecatedUnderscoreRead/ClassMethods.html">ActiveRecord::AttributeMethods::DeprecatedUnderscoreRead::ClassMethods</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/Dirty.html">ActiveRecord::AttributeMethods::Dirty</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/PrimaryKey.html">ActiveRecord::AttributeMethods::PrimaryKey</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/PrimaryKey/ClassMethods.html">ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/Query.html">ActiveRecord::AttributeMethods::Query</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/Read.html">ActiveRecord::AttributeMethods::Read</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/Read/ClassMethods.html">ActiveRecord::AttributeMethods::Read::ClassMethods</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/Serialization.html">ActiveRecord::AttributeMethods::Serialization</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/Serialization/Attribute.html">ActiveRecord::AttributeMethods::Serialization::Attribute</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/Serialization/ClassMethods.html">ActiveRecord::AttributeMethods::Serialization::ClassMethods</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/TimeZoneConversion.html">ActiveRecord::AttributeMethods::TimeZoneConversion</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/TimeZoneConversion/ClassMethods.html">ActiveRecord::AttributeMethods::TimeZoneConversion::ClassMethods</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/Write.html">ActiveRecord::AttributeMethods::Write</a>
  
    <li><a href="../ActiveRecord/AttributeMethods/Write/ClassMethods.html">ActiveRecord::AttributeMethods::Write::ClassMethods</a>
  
    <li><a href="../ActiveRecord/AutosaveAssociation.html">ActiveRecord::AutosaveAssociation</a>
  
    <li><a href="../ActiveRecord/AutosaveAssociation/ClassMethods.html">ActiveRecord::AutosaveAssociation::ClassMethods</a>
  
    <li><a href="../ActiveRecord/Base.html">ActiveRecord::Base</a>
  
    <li><a href="../ActiveRecord/Batches.html">ActiveRecord::Batches</a>
  
    <li><a href="../ActiveRecord/Calculations.html">ActiveRecord::Calculations</a>
  
    <li><a href="../ActiveRecord/Callbacks.html">ActiveRecord::Callbacks</a>
  
    <li><a href="../ActiveRecord/ConfigurationError.html">ActiveRecord::ConfigurationError</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/AbstractAdapter.html">ActiveRecord::ConnectionAdapters::AbstractAdapter</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/AbstractMysqlAdapter.html">ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/ConnectionHandler.html">ActiveRecord::ConnectionAdapters::ConnectionHandler</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/ConnectionManagement.html">ActiveRecord::ConnectionAdapters::ConnectionManagement</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/ConnectionPool.html">ActiveRecord::ConnectionAdapters::ConnectionPool</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/DatabaseLimits.html">ActiveRecord::ConnectionAdapters::DatabaseLimits</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/DatabaseStatements.html">ActiveRecord::ConnectionAdapters::DatabaseStatements</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/Mysql2Adapter.html">ActiveRecord::ConnectionAdapters::Mysql2Adapter</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/MysqlAdapter.html">ActiveRecord::ConnectionAdapters::MysqlAdapter</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/MysqlAdapter/StatementPool.html">ActiveRecord::ConnectionAdapters::MysqlAdapter::StatementPool</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/PostgreSQLAdapter.html">ActiveRecord::ConnectionAdapters::PostgreSQLAdapter</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/PostgreSQLAdapter/StatementPool.html">ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::StatementPool</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/PostgreSQLAdapter/TableDefinition.html">ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/PostgreSQLAdapter/Utils.html">ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::Utils</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/PostgreSQLColumn.html">ActiveRecord::ConnectionAdapters::PostgreSQLColumn</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/QueryCache.html">ActiveRecord::ConnectionAdapters::QueryCache</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/Quoting.html">ActiveRecord::ConnectionAdapters::Quoting</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/SQLiteAdapter.html">ActiveRecord::ConnectionAdapters::SQLiteAdapter</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/SQLiteAdapter/ExplainPrettyPrinter.html">ActiveRecord::ConnectionAdapters::SQLiteAdapter::ExplainPrettyPrinter</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/SQLiteAdapter/StatementPool.html">ActiveRecord::ConnectionAdapters::SQLiteAdapter::StatementPool</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/SQLiteAdapter/Version.html">ActiveRecord::ConnectionAdapters::SQLiteAdapter::Version</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/SchemaCache.html">ActiveRecord::ConnectionAdapters::SchemaCache</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/SchemaStatements.html">ActiveRecord::ConnectionAdapters::SchemaStatements</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/StatementPool.html">ActiveRecord::ConnectionAdapters::StatementPool</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/Table.html">ActiveRecord::ConnectionAdapters::Table</a>
  
    <li><a href="../ActiveRecord/ConnectionAdapters/TableDefinition.html">ActiveRecord::ConnectionAdapters::TableDefinition</a>
  
    <li><a href="../ActiveRecord/ConnectionNotEstablished.html">ActiveRecord::ConnectionNotEstablished</a>
  
    <li><a href="../ActiveRecord/ConnectionTimeoutError.html">ActiveRecord::ConnectionTimeoutError</a>
  
    <li><a href="../ActiveRecord/CounterCache.html">ActiveRecord::CounterCache</a>
  
    <li><a href="../ActiveRecord/DangerousAttributeError.html">ActiveRecord::DangerousAttributeError</a>
  
    <li><a href="../ActiveRecord/Delegation.html">ActiveRecord::Delegation</a>
  
    <li><a href="../ActiveRecord/DynamicFinderMatch.html">ActiveRecord::DynamicFinderMatch</a>
  
    <li><a href="../ActiveRecord/DynamicMatchers.html">ActiveRecord::DynamicMatchers</a>
  
    <li><a href="../ActiveRecord/DynamicScopeMatch.html">ActiveRecord::DynamicScopeMatch</a>
  
    <li><a href="../ActiveRecord/Explain.html">ActiveRecord::Explain</a>
  
    <li><a href="../ActiveRecord/FinderMethods.html">ActiveRecord::FinderMethods</a>
  
    <li><a href="../ActiveRecord/Fixtures.html">ActiveRecord::Fixtures</a>
  
    <li><a href="../ActiveRecord/Fixtures/File.html">ActiveRecord::Fixtures::File</a>
  
    <li><a href="../ActiveRecord/IdentityMap.html">ActiveRecord::IdentityMap</a>
  
    <li><a href="../ActiveRecord/IdentityMap/Middleware.html">ActiveRecord::IdentityMap::Middleware</a>
  
    <li><a href="../ActiveRecord/Inheritance.html">ActiveRecord::Inheritance</a>
  
    <li><a href="../ActiveRecord/Inheritance/ClassMethods.html">ActiveRecord::Inheritance::ClassMethods</a>
  
    <li><a href="../ActiveRecord/Integration.html">ActiveRecord::Integration</a>
  
    <li><a href="../ActiveRecord/InvalidForeignKey.html">ActiveRecord::InvalidForeignKey</a>
  
    <li><a href="../ActiveRecord/IrreversibleMigration.html">ActiveRecord::IrreversibleMigration</a>
  
    <li><a href="../ActiveRecord/Locking.html">ActiveRecord::Locking</a>
  
    <li><a href="../ActiveRecord/Locking/Optimistic.html">ActiveRecord::Locking::Optimistic</a>
  
    <li><a href="../ActiveRecord/Locking/Optimistic/ClassMethods.html">ActiveRecord::Locking::Optimistic::ClassMethods</a>
  
    <li><a href="../ActiveRecord/Locking/Pessimistic.html">ActiveRecord::Locking::Pessimistic</a>
  
    <li><a href="../ActiveRecord/LogSubscriber.html">ActiveRecord::LogSubscriber</a>
  
    <li><a href="../ActiveRecord/Migration.html">ActiveRecord::Migration</a>
  
    <li><a href="../ActiveRecord/Migration/CommandRecorder.html">ActiveRecord::Migration::CommandRecorder</a>
  
    <li><a href="../ActiveRecord/MigrationProxy.html">ActiveRecord::MigrationProxy</a>
  
    <li><a href="../ActiveRecord/ModelSchema.html">ActiveRecord::ModelSchema</a>
  
    <li><a href="../ActiveRecord/ModelSchema/ClassMethods.html">ActiveRecord::ModelSchema::ClassMethods</a>
  
    <li><a href="../ActiveRecord/MultiparameterAssignmentErrors.html">ActiveRecord::MultiparameterAssignmentErrors</a>
  
    <li><a href="../ActiveRecord/NestedAttributes.html">ActiveRecord::NestedAttributes</a>
  
    <li><a href="../ActiveRecord/NestedAttributes/ClassMethods.html">ActiveRecord::NestedAttributes::ClassMethods</a>
  
    <li><a href="../ActiveRecord/NestedAttributes/TooManyRecords.html">ActiveRecord::NestedAttributes::TooManyRecords</a>
  
    <li><a href="../ActiveRecord/Observer.html">ActiveRecord::Observer</a>
  
    <li><a href="../ActiveRecord/Persistence.html">ActiveRecord::Persistence</a>
  
    <li><a href="../ActiveRecord/Persistence/ClassMethods.html">ActiveRecord::Persistence::ClassMethods</a>
  
    <li><a href="../ActiveRecord/PreparedStatementInvalid.html">ActiveRecord::PreparedStatementInvalid</a>
  
    <li><a href="../ActiveRecord/QueryCache.html">ActiveRecord::QueryCache</a>
  
    <li><a href="../ActiveRecord/QueryCache/ClassMethods.html">ActiveRecord::QueryCache::ClassMethods</a>
  
    <li><a href="../ActiveRecord/QueryMethods.html">ActiveRecord::QueryMethods</a>
  
    <li><a href="../ActiveRecord/Querying.html">ActiveRecord::Querying</a>
  
    <li><a href="../ActiveRecord/Railtie.html">ActiveRecord::Railtie</a>
  
    <li><a href="../ActiveRecord/Railties.html">ActiveRecord::Railties</a>
  
    <li><a href="../ActiveRecord/Railties/ControllerRuntime.html">ActiveRecord::Railties::ControllerRuntime</a>
  
    <li><a href="../ActiveRecord/Railties/ControllerRuntime/ClassMethods.html">ActiveRecord::Railties::ControllerRuntime::ClassMethods</a>
  
    <li><a href="../ActiveRecord/ReadOnlyRecord.html">ActiveRecord::ReadOnlyRecord</a>
  
    <li><a href="../ActiveRecord/ReadonlyAttributes.html">ActiveRecord::ReadonlyAttributes</a>
  
    <li><a href="../ActiveRecord/ReadonlyAttributes/ClassMethods.html">ActiveRecord::ReadonlyAttributes::ClassMethods</a>
  
    <li><a href="../ActiveRecord/RecordInvalid.html">ActiveRecord::RecordInvalid</a>
  
    <li><a href="../ActiveRecord/RecordNotFound.html">ActiveRecord::RecordNotFound</a>
  
    <li><a href="../ActiveRecord/RecordNotSaved.html">ActiveRecord::RecordNotSaved</a>
  
    <li><a href="../ActiveRecord/RecordNotUnique.html">ActiveRecord::RecordNotUnique</a>
  
    <li><a href="../ActiveRecord/Reflection.html">ActiveRecord::Reflection</a>
  
    <li><a href="../ActiveRecord/Reflection/ClassMethods.html">ActiveRecord::Reflection::ClassMethods</a>
  
    <li><a href="../ActiveRecord/Reflection/MacroReflection.html">ActiveRecord::Reflection::MacroReflection</a>
  
    <li><a href="../ActiveRecord/Relation.html">ActiveRecord::Relation</a>
  
    <li><a href="../ActiveRecord/Result.html">ActiveRecord::Result</a>
  
    <li><a href="../ActiveRecord/Rollback.html">ActiveRecord::Rollback</a>
  
    <li><a href="../ActiveRecord/Sanitization.html">ActiveRecord::Sanitization</a>
  
    <li><a href="../ActiveRecord/Sanitization/ClassMethods.html">ActiveRecord::Sanitization::ClassMethods</a>
  
    <li><a href="../ActiveRecord/Schema.html">ActiveRecord::Schema</a>
  
    <li><a href="../ActiveRecord/Scoping.html">ActiveRecord::Scoping</a>
  
    <li><a href="../ActiveRecord/Scoping/ClassMethods.html">ActiveRecord::Scoping::ClassMethods</a>
  
    <li><a href="../ActiveRecord/Scoping/Default.html">ActiveRecord::Scoping::Default</a>
  
    <li><a href="../ActiveRecord/Scoping/Default/ClassMethods.html">ActiveRecord::Scoping::Default::ClassMethods</a>
  
    <li><a href="../ActiveRecord/Scoping/Named.html">ActiveRecord::Scoping::Named</a>
  
    <li><a href="../ActiveRecord/Scoping/Named/ClassMethods.html">ActiveRecord::Scoping::Named::ClassMethods</a>
  
    <li><a href="../ActiveRecord/Serialization.html">ActiveRecord::Serialization</a>
  
    <li><a href="../ActiveRecord/SerializationTypeMismatch.html">ActiveRecord::SerializationTypeMismatch</a>
  
    <li><a href="../ActiveRecord/SessionStore.html">ActiveRecord::SessionStore</a>
  
    <li><a href="../ActiveRecord/SessionStore/Session.html">ActiveRecord::SessionStore::Session</a>
  
    <li><a href="../ActiveRecord/SessionStore/SqlBypass.html">ActiveRecord::SessionStore::SqlBypass</a>
  
    <li><a href="../ActiveRecord/SpawnMethods.html">ActiveRecord::SpawnMethods</a>
  
    <li><a href="../ActiveRecord/StaleObjectError.html">ActiveRecord::StaleObjectError</a>
  
    <li><a href="../ActiveRecord/StatementInvalid.html">ActiveRecord::StatementInvalid</a>
  
    <li><a href="../ActiveRecord/Store.html">ActiveRecord::Store</a>
  
    <li><a href="../ActiveRecord/Store/ClassMethods.html">ActiveRecord::Store::ClassMethods</a>
  
    <li><a href="../ActiveRecord/TestFixtures.html">ActiveRecord::TestFixtures</a>
  
    <li><a href="../ActiveRecord/TestFixtures/ClassMethods.html">ActiveRecord::TestFixtures::ClassMethods</a>
  
    <li><a href="../ActiveRecord/ThrowResult.html">ActiveRecord::ThrowResult</a>
  
    <li><a href="../ActiveRecord/Timestamp.html">ActiveRecord::Timestamp</a>
  
    <li><a href="../ActiveRecord/Transactions.html">ActiveRecord::Transactions</a>
  
    <li><a href="../ActiveRecord/Transactions/ClassMethods.html">ActiveRecord::Transactions::ClassMethods</a>
  
    <li><a href="../ActiveRecord/Translation.html">ActiveRecord::Translation</a>
  
    <li><a href="../ActiveRecord/UnknownAttributeError.html">ActiveRecord::UnknownAttributeError</a>
  
    <li><a href="../ActiveRecord/UnknownPrimaryKey.html">ActiveRecord::UnknownPrimaryKey</a>
  
    <li><a href="../ActiveRecord/Validations.html">ActiveRecord::Validations</a>
  
    <li><a href="../ActiveRecord/Validations/AssociatedValidator.html">ActiveRecord::Validations::AssociatedValidator</a>
  
    <li><a href="../ActiveRecord/Validations/ClassMethods.html">ActiveRecord::Validations::ClassMethods</a>
  
    <li><a href="../ActiveRecord/Validations/UniquenessValidator.html">ActiveRecord::Validations::UniquenessValidator</a>
  
    <li><a href="../ActiveRecord/WrappedDatabaseException.html">ActiveRecord::WrappedDatabaseException</a>
  
    <li><a href="../ActiveSupport.html">ActiveSupport</a>
  
    <li><a href="../ActiveSupport/Autoload.html">ActiveSupport::Autoload</a>
  
    <li><a href="../ActiveSupport/BacktraceCleaner.html">ActiveSupport::BacktraceCleaner</a>
  
    <li><a href="../ActiveSupport/Base64.html">ActiveSupport::Base64</a>
  
    <li><a href="../ActiveSupport/BasicObject.html">ActiveSupport::BasicObject</a>
  
    <li><a href="../ActiveSupport/Benchmarkable.html">ActiveSupport::Benchmarkable</a>
  
    <li><a href="../ActiveSupport/BufferedLogger.html">ActiveSupport::BufferedLogger</a>
  
    <li><a href="../ActiveSupport/BufferedLogger/Severity.html">ActiveSupport::BufferedLogger::Severity</a>
  
    <li><a href="../ActiveSupport/Cache.html">ActiveSupport::Cache</a>
  
    <li><a href="../ActiveSupport/Cache/Entry.html">ActiveSupport::Cache::Entry</a>
  
    <li><a href="../ActiveSupport/Cache/FileStore.html">ActiveSupport::Cache::FileStore</a>
  
    <li><a href="../ActiveSupport/Cache/MemCacheStore.html">ActiveSupport::Cache::MemCacheStore</a>
  
    <li><a href="../ActiveSupport/Cache/MemoryStore.html">ActiveSupport::Cache::MemoryStore</a>
  
    <li><a href="../ActiveSupport/Cache/NullStore.html">ActiveSupport::Cache::NullStore</a>
  
    <li><a href="../ActiveSupport/Cache/Store.html">ActiveSupport::Cache::Store</a>
  
    <li><a href="../ActiveSupport/Cache/Strategy.html">ActiveSupport::Cache::Strategy</a>
  
    <li><a href="../ActiveSupport/Cache/Strategy/LocalCache.html">ActiveSupport::Cache::Strategy::LocalCache</a>
  
    <li><a href="../ActiveSupport/Cache/Strategy/LocalCache/LocalStore.html">ActiveSupport::Cache::Strategy::LocalCache::LocalStore</a>
  
    <li><a href="../ActiveSupport/Callbacks.html">ActiveSupport::Callbacks</a>
  
    <li><a href="../ActiveSupport/Callbacks/ClassMethods.html">ActiveSupport::Callbacks::ClassMethods</a>
  
    <li><a href="../ActiveSupport/Concern.html">ActiveSupport::Concern</a>
  
    <li><a href="../ActiveSupport/Configurable.html">ActiveSupport::Configurable</a>
  
    <li><a href="../ActiveSupport/Configurable/ClassMethods.html">ActiveSupport::Configurable::ClassMethods</a>
  
    <li><a href="../ActiveSupport/Configurable/Configuration.html">ActiveSupport::Configurable::Configuration</a>
  
    <li><a href="../ActiveSupport/Dependencies.html">ActiveSupport::Dependencies</a>
  
    <li><a href="../ActiveSupport/Dependencies/ClassCache.html">ActiveSupport::Dependencies::ClassCache</a>
  
    <li><a href="../ActiveSupport/Dependencies/WatchStack.html">ActiveSupport::Dependencies::WatchStack</a>
  
    <li><a href="../ActiveSupport/Deprecation.html">ActiveSupport::Deprecation</a>
  
    <li><a href="../ActiveSupport/DescendantsTracker.html">ActiveSupport::DescendantsTracker</a>
  
    <li><a href="../ActiveSupport/Duration.html">ActiveSupport::Duration</a>
  
    <li><a href="../ActiveSupport/FileUpdateChecker.html">ActiveSupport::FileUpdateChecker</a>
  
    <li><a href="../ActiveSupport/FileWatcher.html">ActiveSupport::FileWatcher</a>
  
    <li><a href="../ActiveSupport/FileWatcher/Backend.html">ActiveSupport::FileWatcher::Backend</a>
  
    <li><a href="../ActiveSupport/Gzip.html">ActiveSupport::Gzip</a>
  
    <li><a href="../ActiveSupport/Gzip/Stream.html">ActiveSupport::Gzip::Stream</a>
  
    <li><a href="../ActiveSupport/HashWithIndifferentAccess.html">ActiveSupport::HashWithIndifferentAccess</a>
  
    <li><a href="../ActiveSupport/HashWithIndifferentAccess.html">ActiveSupport::HashWithIndifferentAccess</a>
  
    <li><a href="../ActiveSupport/Inflector.html">ActiveSupport::Inflector</a>
  
    <li><a href="../ActiveSupport/Inflector/Inflections.html">ActiveSupport::Inflector::Inflections</a>
  
    <li><a href="../ActiveSupport/InheritableOptions.html">ActiveSupport::InheritableOptions</a>
  
    <li><a href="../ActiveSupport/JSON.html">ActiveSupport::JSON</a>
  
    <li><a href="../ActiveSupport/JSON/Encoding.html">ActiveSupport::JSON::Encoding</a>
  
    <li><a href="../ActiveSupport/JSON/Encoding/CircularReferenceError.html">ActiveSupport::JSON::Encoding::CircularReferenceError</a>
  
    <li><a href="../ActiveSupport/JSON/Encoding/Encoder.html">ActiveSupport::JSON::Encoding::Encoder</a>
  
    <li><a href="../ActiveSupport/JSON/Variable.html">ActiveSupport::JSON::Variable</a>
  
    <li><a href="../ActiveSupport/LogSubscriber.html">ActiveSupport::LogSubscriber</a>
  
    <li><a href="../ActiveSupport/LogSubscriber/TestHelper.html">ActiveSupport::LogSubscriber::TestHelper</a>
  
    <li><a href="../ActiveSupport/LogSubscriber/TestHelper/MockLogger.html">ActiveSupport::LogSubscriber::TestHelper::MockLogger</a>
  
    <li><a href="../ActiveSupport/Memoizable.html">ActiveSupport::Memoizable</a>
  
    <li><a href="../ActiveSupport/Memoizable/InstanceMethods.html">ActiveSupport::Memoizable::InstanceMethods</a>
  
    <li><a href="../ActiveSupport/MessageEncryptor.html">ActiveSupport::MessageEncryptor</a>
  
    <li><a href="../ActiveSupport/MessageEncryptor/InvalidMessage.html">ActiveSupport::MessageEncryptor::InvalidMessage</a>
  
    <li><a href="../ActiveSupport/MessageVerifier.html">ActiveSupport::MessageVerifier</a>
  
    <li><a href="../ActiveSupport/MessageVerifier/InvalidSignature.html">ActiveSupport::MessageVerifier::InvalidSignature</a>
  
    <li><a href="../ActiveSupport/Multibyte.html">ActiveSupport::Multibyte</a>
  
    <li><a href="../ActiveSupport/Multibyte/Chars.html">ActiveSupport::Multibyte::Chars</a>
  
    <li><a href="../ActiveSupport/Multibyte/EncodingError.html">ActiveSupport::Multibyte::EncodingError</a>
  
    <li><a href="../ActiveSupport/Multibyte/Unicode.html">ActiveSupport::Multibyte::Unicode</a>
  
    <li><a href="../ActiveSupport/Multibyte/Unicode/Codepoint.html">ActiveSupport::Multibyte::Unicode::Codepoint</a>
  
    <li><a href="../ActiveSupport/Multibyte/Unicode/UnicodeDatabase.html">ActiveSupport::Multibyte::Unicode::UnicodeDatabase</a>
  
    <li><a href="../ActiveSupport/Notifications.html">ActiveSupport::Notifications</a>
  
    <li><a href="../ActiveSupport/Notifications/Event.html">ActiveSupport::Notifications::Event</a>
  
    <li><a href="../ActiveSupport/Notifications/Fanout.html">ActiveSupport::Notifications::Fanout</a>
  
    <li><a href="../ActiveSupport/Notifications/Instrumenter.html">ActiveSupport::Notifications::Instrumenter</a>
  
    <li><a href="../ActiveSupport/OrderedHash.html">ActiveSupport::OrderedHash</a>
  
    <li><a href="../ActiveSupport/OrderedOptions.html">ActiveSupport::OrderedOptions</a>
  
    <li><a href="../ActiveSupport/Railtie.html">ActiveSupport::Railtie</a>
  
    <li><a href="../ActiveSupport/Rescuable.html">ActiveSupport::Rescuable</a>
  
    <li><a href="../ActiveSupport/Rescuable/ClassMethods.html">ActiveSupport::Rescuable::ClassMethods</a>
  
    <li><a href="../ActiveSupport/SafeBuffer.html">ActiveSupport::SafeBuffer</a>
  
    <li><a href="../ActiveSupport/SafeBuffer/SafeConcatError.html">ActiveSupport::SafeBuffer::SafeConcatError</a>
  
    <li><a href="../ActiveSupport/StringInquirer.html">ActiveSupport::StringInquirer</a>
  
    <li><a href="../ActiveSupport/TaggedLogging.html">ActiveSupport::TaggedLogging</a>
  
    <li><a href="../ActiveSupport/TestCase.html">ActiveSupport::TestCase</a>
  
    <li><a href="../ActiveSupport/Testing.html">ActiveSupport::Testing</a>
  
    <li><a href="../ActiveSupport/Testing/Assertions.html">ActiveSupport::Testing::Assertions</a>
  
    <li><a href="../ActiveSupport/Testing/Declarative.html">ActiveSupport::Testing::Declarative</a>
  
    <li><a href="../ActiveSupport/Testing/Isolation.html">ActiveSupport::Testing::Isolation</a>
  
    <li><a href="../ActiveSupport/Testing/Isolation/Forking.html">ActiveSupport::Testing::Isolation::Forking</a>
  
    <li><a href="../ActiveSupport/Testing/Isolation/MiniTest.html">ActiveSupport::Testing::Isolation::MiniTest</a>
  
    <li><a href="../ActiveSupport/Testing/Isolation/Subprocess.html">ActiveSupport::Testing::Isolation::Subprocess</a>
  
    <li><a href="../ActiveSupport/Testing/Isolation/TestUnit.html">ActiveSupport::Testing::Isolation::TestUnit</a>
  
    <li><a href="../ActiveSupport/Testing/Pending.html">ActiveSupport::Testing::Pending</a>
  
    <li><a href="../ActiveSupport/Testing/Performance.html">ActiveSupport::Testing::Performance</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Benchmarker.html">ActiveSupport::Testing::Performance::Benchmarker</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/ForClassicTestUnit.html">ActiveSupport::Testing::Performance::ForClassicTestUnit</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/ForMiniTest.html">ActiveSupport::Testing::Performance::ForMiniTest</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics.html">ActiveSupport::Testing::Performance::Metrics</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics/Amount.html">ActiveSupport::Testing::Performance::Metrics::Amount</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics/Base.html">ActiveSupport::Testing::Performance::Metrics::Base</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics/CpuTime.html">ActiveSupport::Testing::Performance::Metrics::CpuTime</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics/DigitalInformationUnit.html">ActiveSupport::Testing::Performance::Metrics::DigitalInformationUnit</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics/GcRuns.html">ActiveSupport::Testing::Performance::Metrics::GcRuns</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics/GcTime.html">ActiveSupport::Testing::Performance::Metrics::GcTime</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics/Memory.html">ActiveSupport::Testing::Performance::Metrics::Memory</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics/Objects.html">ActiveSupport::Testing::Performance::Metrics::Objects</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics/ProcessTime.html">ActiveSupport::Testing::Performance::Metrics::ProcessTime</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics/Time.html">ActiveSupport::Testing::Performance::Metrics::Time</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics/UserTime.html">ActiveSupport::Testing::Performance::Metrics::UserTime</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Metrics/WallTime.html">ActiveSupport::Testing::Performance::Metrics::WallTime</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Performer.html">ActiveSupport::Testing::Performance::Performer</a>
  
    <li><a href="../ActiveSupport/Testing/Performance/Profiler.html">ActiveSupport::Testing::Performance::Profiler</a>
  
    <li><a href="../ActiveSupport/Testing/ProxyTestResult.html">ActiveSupport::Testing::ProxyTestResult</a>
  
    <li><a href="../ActiveSupport/Testing/RemoteError.html">ActiveSupport::Testing::RemoteError</a>
  
    <li><a href="../ActiveSupport/Testing/SetupAndTeardown.html">ActiveSupport::Testing::SetupAndTeardown</a>
  
    <li><a href="../ActiveSupport/Testing/SetupAndTeardown/ClassMethods.html">ActiveSupport::Testing::SetupAndTeardown::ClassMethods</a>
  
    <li><a href="../ActiveSupport/Testing/SetupAndTeardown/ForClassicTestUnit.html">ActiveSupport::Testing::SetupAndTeardown::ForClassicTestUnit</a>
  
    <li><a href="../ActiveSupport/Testing/SetupAndTeardown/ForMiniTest.html">ActiveSupport::Testing::SetupAndTeardown::ForMiniTest</a>
  
    <li><a href="../ActiveSupport/TimeWithZone.html">ActiveSupport::TimeWithZone</a>
  
    <li><a href="../ActiveSupport/TimeZone.html">ActiveSupport::TimeZone</a>
  
    <li><a href="../ActiveSupport/XmlMini.html">ActiveSupport::XmlMini</a>
  
    <li><a href="../ActiveSupport/XmlMini_LibXMLSAX.html">ActiveSupport::XmlMini_LibXMLSAX</a>
  
    <li><a href="../ActiveSupport/XmlMini_LibXMLSAX/HashBuilder.html">ActiveSupport::XmlMini_LibXMLSAX::HashBuilder</a>
  
    <li><a href="../ActiveSupport/XmlMini_NokogiriSAX.html">ActiveSupport::XmlMini_NokogiriSAX</a>
  
    <li><a href="../ActiveSupport/XmlMini_NokogiriSAX/HashBuilder.html">ActiveSupport::XmlMini_NokogiriSAX::HashBuilder</a>
  
    <li><a href="../ActionController.html">ActionController</a>
  
    <li><a href="../ActionController/Base.html">ActionController::Base</a>
  
    <li><a href="../ActionController/Caching.html">ActionController::Caching</a>
  
    <li><a href="../ActionController/Caching/Actions.html">ActionController::Caching::Actions</a>
  
    <li><a href="../ActionController/Caching/Actions/ActionCachePath.html">ActionController::Caching::Actions::ActionCachePath</a>
  
    <li><a href="../ActionController/Caching/Actions/ClassMethods.html">ActionController::Caching::Actions::ClassMethods</a>
  
    <li><a href="../ActionController/Caching/ConfigMethods.html">ActionController::Caching::ConfigMethods</a>
  
    <li><a href="../ActionController/Caching/Fragments.html">ActionController::Caching::Fragments</a>
  
    <li><a href="../ActionController/Caching/Pages.html">ActionController::Caching::Pages</a>
  
    <li><a href="../ActionController/Caching/Pages/ClassMethods.html">ActionController::Caching::Pages::ClassMethods</a>
  
    <li><a href="../ActionController/Caching/Sweeping.html">ActionController::Caching::Sweeping</a>
  
    <li><a href="../ActionController/Compatibility.html">ActionController::Compatibility</a>
  
    <li><a href="../ActionController/ConditionalGet.html">ActionController::ConditionalGet</a>
  
    <li><a href="../ActionController/Cookies.html">ActionController::Cookies</a>
  
    <li><a href="../ActionController/DataStreaming.html">ActionController::DataStreaming</a>
  
    <li><a href="../ActionController/Flash.html">ActionController::Flash</a>
  
    <li><a href="../ActionController/ForceSSL.html">ActionController::ForceSSL</a>
  
    <li><a href="../ActionController/ForceSSL/ClassMethods.html">ActionController::ForceSSL::ClassMethods</a>
  
    <li><a href="../ActionController/Head.html">ActionController::Head</a>
  
    <li><a href="../ActionController/Helpers.html">ActionController::Helpers</a>
  
    <li><a href="../ActionController/Helpers/ClassMethods.html">ActionController::Helpers::ClassMethods</a>
  
    <li><a href="../ActionController/HideActions.html">ActionController::HideActions</a>
  
    <li><a href="../ActionController/HideActions/ClassMethods.html">ActionController::HideActions::ClassMethods</a>
  
    <li><a href="../ActionController/HttpAuthentication.html">ActionController::HttpAuthentication</a>
  
    <li><a href="../ActionController/HttpAuthentication/Basic.html">ActionController::HttpAuthentication::Basic</a>
  
    <li><a href="../ActionController/HttpAuthentication/Basic/ControllerMethods.html">ActionController::HttpAuthentication::Basic::ControllerMethods</a>
  
    <li><a href="../ActionController/HttpAuthentication/Basic/ControllerMethods/ClassMethods.html">ActionController::HttpAuthentication::Basic::ControllerMethods::ClassMethods</a>
  
    <li><a href="../ActionController/HttpAuthentication/Digest.html">ActionController::HttpAuthentication::Digest</a>
  
    <li><a href="../ActionController/HttpAuthentication/Digest/ControllerMethods.html">ActionController::HttpAuthentication::Digest::ControllerMethods</a>
  
    <li><a href="../ActionController/HttpAuthentication/Token.html">ActionController::HttpAuthentication::Token</a>
  
    <li><a href="../ActionController/HttpAuthentication/Token/ControllerMethods.html">ActionController::HttpAuthentication::Token::ControllerMethods</a>
  
    <li><a href="../ActionController/ImplicitRender.html">ActionController::ImplicitRender</a>
  
    <li><a href="../ActionController/Instrumentation.html">ActionController::Instrumentation</a>
  
    <li><a href="../ActionController/Instrumentation/ClassMethods.html">ActionController::Instrumentation::ClassMethods</a>
  
    <li><a href="../ActionController/LogSubscriber.html">ActionController::LogSubscriber</a>
  
    <li><a href="../ActionController/Metal.html">ActionController::Metal</a>
  
    <li><a href="../ActionController/Middleware.html">ActionController::Middleware</a>
  
    <li><a href="../ActionController/Middleware/ActionMiddleware.html">ActionController::Middleware::ActionMiddleware</a>
  
    <li><a href="../ActionController/MimeResponds.html">ActionController::MimeResponds</a>
  
    <li><a href="../ActionController/MimeResponds/ClassMethods.html">ActionController::MimeResponds::ClassMethods</a>
  
    <li><a href="../ActionController/ParamsWrapper.html">ActionController::ParamsWrapper</a>
  
    <li><a href="../ActionController/ParamsWrapper/ClassMethods.html">ActionController::ParamsWrapper::ClassMethods</a>
  
    <li><a href="../ActionController/RackDelegation.html">ActionController::RackDelegation</a>
  
    <li><a href="../ActionController/Railtie.html">ActionController::Railtie</a>
  
    <li><a href="../ActionController/Railties.html">ActionController::Railties</a>
  
    <li><a href="../ActionController/Railties/Paths.html">ActionController::Railties::Paths</a>
  
    <li><a href="../ActionController/RecordIdentifier.html">ActionController::RecordIdentifier</a>
  
    <li><a href="../ActionController/Redirecting.html">ActionController::Redirecting</a>
  
    <li><a href="../ActionController/Renderers.html">ActionController::Renderers</a>
  
    <li><a href="../ActionController/Renderers/All.html">ActionController::Renderers::All</a>
  
    <li><a href="../ActionController/Renderers/ClassMethods.html">ActionController::Renderers::ClassMethods</a>
  
    <li><a href="../ActionController/Rendering.html">ActionController::Rendering</a>
  
    <li><a href="../ActionController/RequestForgeryProtection.html">ActionController::RequestForgeryProtection</a>
  
    <li><a href="../ActionController/RequestForgeryProtection/ClassMethods.html">ActionController::RequestForgeryProtection::ClassMethods</a>
  
    <li><a href="../ActionController/Rescue.html">ActionController::Rescue</a>
  
    <li><a href="../ActionController/Responder.html">ActionController::Responder</a>
  
    <li><a href="../ActionController/SessionManagement.html">ActionController::SessionManagement</a>
  
    <li><a href="../ActionController/SessionManagement/ClassMethods.html">ActionController::SessionManagement::ClassMethods</a>
  
    <li><a href="../ActionController/Streaming.html">ActionController::Streaming</a>
  
    <li><a href="../ActionController/TemplateAssertions.html">ActionController::TemplateAssertions</a>
  
    <li><a href="../ActionController/TestCase.html">ActionController::TestCase</a>
  
    <li><a href="../ActionController/TestCase/Behavior.html">ActionController::TestCase::Behavior</a>
  
    <li><a href="../ActionController/TestCase/Behavior/ClassMethods.html">ActionController::TestCase::Behavior::ClassMethods</a>
  
    <li><a href="../ActionController/TestCase/RaiseActionExceptions.html">ActionController::TestCase::RaiseActionExceptions</a>
  
    <li><a href="../ActionController/TestResponse.html">ActionController::TestResponse</a>
  
    <li><a href="../ActionController/Testing.html">ActionController::Testing</a>
  
    <li><a href="../ActionController/Testing/ClassMethods.html">ActionController::Testing::ClassMethods</a>
  
    <li><a href="../ActionController/UrlFor.html">ActionController::UrlFor</a>
  
    <li><a href="../ActionView.html">ActionView</a>
  
    <li><a href="../ActionView/ActionView.html">ActionView::ActionView</a>
  
    <li><a href="../ActionView/ActionView/ActionView.html">ActionView::ActionView::ActionView</a>
  
    <li><a href="../ActionView/ActionView/ActionView/Base.html">ActionView::ActionView::ActionView::Base</a>
  
    <li><a href="../ActionView/Base.html">ActionView::Base</a>
  
    <li><a href="../ActionView/Context.html">ActionView::Context</a>
  
    <li><a href="../ActionView/FileSystemResolver.html">ActionView::FileSystemResolver</a>
  
    <li><a href="../ActionView/FixtureResolver.html">ActionView::FixtureResolver</a>
  
    <li><a href="../ActionView/Helpers.html">ActionView::Helpers</a>
  
    <li><a href="../ActionView/Helpers/ActiveModelHelper.html">ActionView::Helpers::ActiveModelHelper</a>
  
    <li><a href="../ActionView/Helpers/ActiveModelInstanceTag.html">ActionView::Helpers::ActiveModelInstanceTag</a>
  
    <li><a href="../ActionView/Helpers/AssetTagHelper.html">ActionView::Helpers::AssetTagHelper</a>
  
    <li><a href="../ActionView/Helpers/AssetTagHelper/AssetIncludeTag.html">ActionView::Helpers::AssetTagHelper::AssetIncludeTag</a>
  
    <li><a href="../ActionView/Helpers/AssetTagHelper/JavascriptIncludeTag.html">ActionView::Helpers::AssetTagHelper::JavascriptIncludeTag</a>
  
    <li><a href="../ActionView/Helpers/AssetTagHelper/JavascriptTagHelpers.html">ActionView::Helpers::AssetTagHelper::JavascriptTagHelpers</a>
  
    <li><a href="../ActionView/Helpers/AssetTagHelper/JavascriptTagHelpers/ClassMethods.html">ActionView::Helpers::AssetTagHelper::JavascriptTagHelpers::ClassMethods</a>
  
    <li><a href="../ActionView/Helpers/AssetTagHelper/StylesheetIncludeTag.html">ActionView::Helpers::AssetTagHelper::StylesheetIncludeTag</a>
  
    <li><a href="../ActionView/Helpers/AssetTagHelper/StylesheetTagHelpers.html">ActionView::Helpers::AssetTagHelper::StylesheetTagHelpers</a>
  
    <li><a href="../ActionView/Helpers/AssetTagHelper/StylesheetTagHelpers/ClassMethods.html">ActionView::Helpers::AssetTagHelper::StylesheetTagHelpers::ClassMethods</a>
  
    <li><a href="../ActionView/Helpers/AtomFeedHelper.html">ActionView::Helpers::AtomFeedHelper</a>
  
    <li><a href="../ActionView/Helpers/AtomFeedHelper/AtomBuilder.html">ActionView::Helpers::AtomFeedHelper::AtomBuilder</a>
  
    <li><a href="../ActionView/Helpers/AtomFeedHelper/AtomFeedBuilder.html">ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder</a>
  
    <li><a href="../ActionView/Helpers/CacheHelper.html">ActionView::Helpers::CacheHelper</a>
  
    <li><a href="../ActionView/Helpers/CaptureHelper.html">ActionView::Helpers::CaptureHelper</a>
  
    <li><a href="../ActionView/Helpers/CsrfHelper.html">ActionView::Helpers::CsrfHelper</a>
  
    <li><a href="../ActionView/Helpers/DateHelper.html">ActionView::Helpers::DateHelper</a>
  
    <li><a href="../ActionView/Helpers/DateHelperInstanceTag.html">ActionView::Helpers::DateHelperInstanceTag</a>
  
    <li><a href="../ActionView/Helpers/DebugHelper.html">ActionView::Helpers::DebugHelper</a>
  
    <li><a href="../ActionView/Helpers/FormBuilder.html">ActionView::Helpers::FormBuilder</a>
  
    <li><a href="../ActionView/Helpers/FormHelper.html">ActionView::Helpers::FormHelper</a>
  
    <li><a href="../ActionView/Helpers/FormOptionsHelper.html">ActionView::Helpers::FormOptionsHelper</a>
  
    <li><a href="../ActionView/Helpers/FormTagHelper.html">ActionView::Helpers::FormTagHelper</a>
  
    <li><a href="../ActionView/Helpers/InstanceTag.html">ActionView::Helpers::InstanceTag</a>
  
    <li><a href="../ActionView/Helpers/JavaScriptHelper.html">ActionView::Helpers::JavaScriptHelper</a>
  
    <li><a href="../ActionView/Helpers/NumberHelper.html">ActionView::Helpers::NumberHelper</a>
  
    <li><a href="../ActionView/Helpers/NumberHelper/InvalidNumberError.html">ActionView::Helpers::NumberHelper::InvalidNumberError</a>
  
    <li><a href="../ActionView/Helpers/OutputSafetyHelper.html">ActionView::Helpers::OutputSafetyHelper</a>
  
    <li><a href="../ActionView/Helpers/RecordTagHelper.html">ActionView::Helpers::RecordTagHelper</a>
  
    <li><a href="../ActionView/Helpers/RenderingHelper.html">ActionView::Helpers::RenderingHelper</a>
  
    <li><a href="../ActionView/Helpers/SanitizeHelper.html">ActionView::Helpers::SanitizeHelper</a>
  
    <li><a href="../ActionView/Helpers/TagHelper.html">ActionView::Helpers::TagHelper</a>
  
    <li><a href="../ActionView/Helpers/TextHelper.html">ActionView::Helpers::TextHelper</a>
  
    <li><a href="../ActionView/Helpers/TranslationHelper.html">ActionView::Helpers::TranslationHelper</a>
  
    <li><a href="../ActionView/Helpers/UrlHelper.html">ActionView::Helpers::UrlHelper</a>
  
    <li><a href="../ActionView/LogSubscriber.html">ActionView::LogSubscriber</a>
  
    <li><a href="../ActionView/LookupContext.html">ActionView::LookupContext</a>
  
    <li><a href="../ActionView/LookupContext/DetailsCache.html">ActionView::LookupContext::DetailsCache</a>
  
    <li><a href="../ActionView/LookupContext/ViewPaths.html">ActionView::LookupContext::ViewPaths</a>
  
    <li><a href="../ActionView/NullResolver.html">ActionView::NullResolver</a>
  
    <li><a href="../ActionView/PartialRenderer.html">ActionView::PartialRenderer</a>
  
    <li><a href="../ActionView/Railtie.html">ActionView::Railtie</a>
  
    <li><a href="../ActionView/Renderer.html">ActionView::Renderer</a>
  
    <li><a href="../ActionView/Resolver.html">ActionView::Resolver</a>
  
    <li><a href="../ActionView/Resolver/Path.html">ActionView::Resolver::Path</a>
  
    <li><a href="../ActionView/Template.html">ActionView::Template</a>
  
    <li><a href="../ActionView/Template/Handlers.html">ActionView::Template::Handlers</a>
  
    <li><a href="../ActionView/Template/Handlers/Builder.html">ActionView::Template::Handlers::Builder</a>
  
    <li><a href="../ActionView/Template/Handlers/ERB.html">ActionView::Template::Handlers::ERB</a>
  
    <li><a href="../ActionView/Template/Handlers/Erubis.html">ActionView::Template::Handlers::Erubis</a>
  
    <li><a href="../ActionView/TestCase.html">ActionView::TestCase</a>
  
    <li><a href="../ActionView/TestCase/Behavior.html">ActionView::TestCase::Behavior</a>
  
    <li><a href="../ActionView/TestCase/Behavior/ClassMethods.html">ActionView::TestCase::Behavior::ClassMethods</a>
  
    <li><a href="../ActionView/TestCase/Behavior/Locals.html">ActionView::TestCase::Behavior::Locals</a>
  
    <li><a href="../ActionView/TestCase/TestController.html">ActionView::TestCase::TestController</a>
  
    <li><a href="../ActiveModel.html">ActiveModel</a>
  
    <li><a href="../ActiveModel/AttributeMethods.html">ActiveModel::AttributeMethods</a>
  
    <li><a href="../ActiveModel/AttributeMethods/ClassMethods.html">ActiveModel::AttributeMethods::ClassMethods</a>
  
    <li><a href="../ActiveModel/AttributeMethods/ClassMethods/AttributeMethodMatcher.html">ActiveModel::AttributeMethods::ClassMethods::AttributeMethodMatcher</a>
  
    <li><a href="../ActiveModel/BlockValidator.html">ActiveModel::BlockValidator</a>
  
    <li><a href="../ActiveModel/Callbacks.html">ActiveModel::Callbacks</a>
  
    <li><a href="../ActiveModel/Conversion.html">ActiveModel::Conversion</a>
  
    <li><a href="../ActiveModel/Dirty.html">ActiveModel::Dirty</a>
  
    <li><a href="../ActiveModel/EachValidator.html">ActiveModel::EachValidator</a>
  
    <li><a href="../ActiveModel/Errors.html">ActiveModel::Errors</a>
  
    <li><a href="../ActiveModel/Lint.html">ActiveModel::Lint</a>
  
    <li><a href="../ActiveModel/Lint/Tests.html">ActiveModel::Lint::Tests</a>
  
    <li><a href="../ActiveModel/MassAssignmentSecurity.html">ActiveModel::MassAssignmentSecurity</a>
  
    <li><a href="../ActiveModel/MassAssignmentSecurity/BlackList.html">ActiveModel::MassAssignmentSecurity::BlackList</a>
  
    <li><a href="../ActiveModel/MassAssignmentSecurity/ClassMethods.html">ActiveModel::MassAssignmentSecurity::ClassMethods</a>
  
    <li><a href="../ActiveModel/MassAssignmentSecurity/Error.html">ActiveModel::MassAssignmentSecurity::Error</a>
  
    <li><a href="../ActiveModel/MassAssignmentSecurity/LoggerSanitizer.html">ActiveModel::MassAssignmentSecurity::LoggerSanitizer</a>
  
    <li><a href="../ActiveModel/MassAssignmentSecurity/PermissionSet.html">ActiveModel::MassAssignmentSecurity::PermissionSet</a>
  
    <li><a href="../ActiveModel/MassAssignmentSecurity/Sanitizer.html">ActiveModel::MassAssignmentSecurity::Sanitizer</a>
  
    <li><a href="../ActiveModel/MassAssignmentSecurity/StrictSanitizer.html">ActiveModel::MassAssignmentSecurity::StrictSanitizer</a>
  
    <li><a href="../ActiveModel/MassAssignmentSecurity/WhiteList.html">ActiveModel::MassAssignmentSecurity::WhiteList</a>
  
    <li><a href="../ActiveModel/MissingAttributeError.html">ActiveModel::MissingAttributeError</a>
  
    <li><a href="../ActiveModel/Name.html">ActiveModel::Name</a>
  
    <li><a href="../ActiveModel/Naming.html">ActiveModel::Naming</a>
  
    <li><a href="../ActiveModel/Observer.html">ActiveModel::Observer</a>
  
    <li><a href="../ActiveModel/ObserverArray.html">ActiveModel::ObserverArray</a>
  
    <li><a href="../ActiveModel/Observing.html">ActiveModel::Observing</a>
  
    <li><a href="../ActiveModel/Observing/ClassMethods.html">ActiveModel::Observing::ClassMethods</a>
  
    <li><a href="../ActiveModel/SecurePassword.html">ActiveModel::SecurePassword</a>
  
    <li><a href="../ActiveModel/SecurePassword/ClassMethods.html">ActiveModel::SecurePassword::ClassMethods</a>
  
    <li><a href="../ActiveModel/SecurePassword/InstanceMethodsOnActivation.html">ActiveModel::SecurePassword::InstanceMethodsOnActivation</a>
  
    <li><a href="../ActiveModel/Serialization.html">ActiveModel::Serialization</a>
  
    <li><a href="../ActiveModel/Serializers.html">ActiveModel::Serializers</a>
  
    <li><a href="../ActiveModel/Serializers/JSON.html">ActiveModel::Serializers::JSON</a>
  
    <li><a href="../ActiveModel/Serializers/Xml.html">ActiveModel::Serializers::Xml</a>
  
    <li><a href="../ActiveModel/StrictValidationFailed.html">ActiveModel::StrictValidationFailed</a>
  
    <li><a href="../ActiveModel/Translation.html">ActiveModel::Translation</a>
  
    <li><a href="../ActiveModel/Validations.html">ActiveModel::Validations</a>
  
    <li><a href="../ActiveModel/Validations/AcceptanceValidator.html">ActiveModel::Validations::AcceptanceValidator</a>
  
    <li><a href="../ActiveModel/Validations/Callbacks.html">ActiveModel::Validations::Callbacks</a>
  
    <li><a href="../ActiveModel/Validations/Callbacks/ClassMethods.html">ActiveModel::Validations::Callbacks::ClassMethods</a>
  
    <li><a href="../ActiveModel/Validations/ClassMethods.html">ActiveModel::Validations::ClassMethods</a>
  
    <li><a href="../ActiveModel/Validations/ConfirmationValidator.html">ActiveModel::Validations::ConfirmationValidator</a>
  
    <li><a href="../ActiveModel/Validations/ExclusionValidator.html">ActiveModel::Validations::ExclusionValidator</a>
  
    <li><a href="../ActiveModel/Validations/FormatValidator.html">ActiveModel::Validations::FormatValidator</a>
  
    <li><a href="../ActiveModel/Validations/HelperMethods.html">ActiveModel::Validations::HelperMethods</a>
  
    <li><a href="../ActiveModel/Validations/InclusionValidator.html">ActiveModel::Validations::InclusionValidator</a>
  
    <li><a href="../ActiveModel/Validations/LengthValidator.html">ActiveModel::Validations::LengthValidator</a>
  
    <li><a href="../ActiveModel/Validations/NumericalityValidator.html">ActiveModel::Validations::NumericalityValidator</a>
  
    <li><a href="../ActiveModel/Validations/PresenceValidator.html">ActiveModel::Validations::PresenceValidator</a>
  
    <li><a href="../ActiveModel/Validations/WithValidator.html">ActiveModel::Validations::WithValidator</a>
  
    <li><a href="../ActiveModel/Validator.html">ActiveModel::Validator</a>
  
    <li><a href="../ActiveResource.html">ActiveResource</a>
  
    <li><a href="../ActiveResource/Base.html">ActiveResource::Base</a>
  
    <li><a href="../ActiveResource/Connection.html">ActiveResource::Connection</a>
  
    <li><a href="../ActiveResource/CustomMethods.html">ActiveResource::CustomMethods</a>
  
    <li><a href="../ActiveResource/CustomMethods/ClassMethods.html">ActiveResource::CustomMethods::ClassMethods</a>
  
    <li><a href="../ActiveResource/Errors.html">ActiveResource::Errors</a>
  
    <li><a href="../ActiveResource/Formats.html">ActiveResource::Formats</a>
  
    <li><a href="../ActiveResource/Formats/JsonFormat.html">ActiveResource::Formats::JsonFormat</a>
  
    <li><a href="../ActiveResource/Formats/XmlFormat.html">ActiveResource::Formats::XmlFormat</a>
  
    <li><a href="../ActiveResource/HttpMock.html">ActiveResource::HttpMock</a>
  
    <li><a href="../ActiveResource/InvalidRequestError.html">ActiveResource::InvalidRequestError</a>
  
    <li><a href="../ActiveResource/LogSubscriber.html">ActiveResource::LogSubscriber</a>
  
    <li><a href="../ActiveResource/Observing.html">ActiveResource::Observing</a>
  
    <li><a href="../ActiveResource/Railtie.html">ActiveResource::Railtie</a>
  
    <li><a href="../ActiveResource/Request.html">ActiveResource::Request</a>
  
    <li><a href="../ActiveResource/Response.html">ActiveResource::Response</a>
  
    <li><a href="../ActiveResource/SSLError.html">ActiveResource::SSLError</a>
  
    <li><a href="../ActiveResource/TimeoutError.html">ActiveResource::TimeoutError</a>
  
    <li><a href="../ActiveResource/Validations.html">ActiveResource::Validations</a>
  
    <li><a href="../HTML.html">HTML</a>
  
    <li><a href="../HTML/FullSanitizer.html">HTML::FullSanitizer</a>
  
    <li><a href="../HTML/LinkSanitizer.html">HTML::LinkSanitizer</a>
  
    <li><a href="../HTML/Sanitizer.html">HTML::Sanitizer</a>
  
    <li><a href="../HTML/Selector.html">HTML::Selector</a>
  
    <li><a href="../HTML/Tag.html">HTML::Tag</a>
  
    <li><a href="../HTML/WhiteListSanitizer.html">HTML::WhiteListSanitizer</a>
  
    <li><a href="../Mysql.html">Mysql</a>
  
    <li><a href="../Mysql/Result.html">Mysql::Result</a>
  
    <li><a href="../Mysql/Stmt.html">Mysql::Stmt</a>
  
    <li><a href="../Mysql/Time.html">Mysql::Time</a>
  
    <li><a href="../Test.html">Test</a>
  
    <li><a href="../Test/Unit.html">Test::Unit</a>
  
    <li><a href="../Test/Unit/Collector.html">Test::Unit::Collector</a>
  
    <li><a href="../Test/Unit/Collector/ObjectSpace.html">Test::Unit::Collector::ObjectSpace</a>
  
    <li><a href="../I18n.html">I18n</a>
  
    <li><a href="../I18n/ExceptionHandler.html">I18n::ExceptionHandler</a>
  
    <li><a href="../I18n/Railtie.html">I18n::Railtie</a>
  
    <li><a href="../Object.html">Object</a>
  
    <li><a href="../ActiveSupport/HashWithIndifferentAccess.html">Object::HashWithIndifferentAccess</a>
  
    <li><a href="../LoadError.html">Object::MissingSourceFile</a>
  
    <li><a href="../ActionMailer.html">ActionMailer</a>
  
    <li><a href="../ActionMailer/Base.html">ActionMailer::Base</a>
  
    <li><a href="../ArJdbcMySQL.html">ArJdbcMySQL</a>
  
    <li><a href="../ArJdbcMySQL/Error.html">ArJdbcMySQL::Error</a>
  
    <li><a href="../ERB.html">ERB</a>
  
    <li><a href="../ERB/Util.html">ERB::Util</a>
  
    <li><a href="../LoadError.html">LoadError</a>
  
    <li><a href="../LoadError.html">LoadError</a>
  
    <li><a href="../Logger.html">Logger</a>
  
    <li><a href="../Logger/SimpleFormatter.html">Logger::SimpleFormatter</a>
  
    <li><a href="../Array.html">Array</a>
  
    <li><a href="../Base64.html">Base64</a>
  
    <li><a href="../Benchmark.html">Benchmark</a>
  
    <li><a href="../BigDecimal.html">BigDecimal</a>
  
    <li><a href="../Class.html">Class</a>
  
    <li><a href="../Date.html">Date</a>
  
    <li><a href="../DateTime.html">DateTime</a>
  
    <li><a href="../Enumerable.html">Enumerable</a>
  
    <li><a href="../FalseClass.html">FalseClass</a>
  
    <li><a href="../File.html">File</a>
  
    <li><a href="../Float.html">Float</a>
  
    <li><a href="../Hash.html">Hash</a>
  
    <li><a href="../Integer.html">Integer</a>
  
    <li><a href="../Kernel.html">Kernel</a>
  
    <li><a href="../Module.html">Module</a>
  
    <li><a href="../NameError.html">NameError</a>
  
    <li><a href="../NilClass.html">NilClass</a>
  
    <li><a href="../Numeric.html">Numeric</a>
  
    <li><a href="../Process.html">Process</a>
  
    <li><a href="../QualifiedConstUtils.html">QualifiedConstUtils</a>
  
    <li><a href="../Rails.html">Rails</a>
  
    <li><a href="../Range.html">Range</a>
  
    <li><a href="../Regexp.html">Regexp</a>
  
    <li><a href="../String.html">String</a>
  
    <li><a href="../Symbol.html">Symbol</a>
  
    <li><a href="../Time.html">Time</a>
  
    <li><a href="../TrueClass.html">TrueClass</a>
  
    <li><a href="../URI.html">URI</a>
  
  </ul>
</nav>

  </div>
</nav>

<div id="documentation">
  <h1 class="class">class ActiveResource::Base</h1>

  <div id="description" class="description">
    
<p><a href="Base.html">ActiveResource::Base</a> is the main class for mapping
RESTful resources as models in a <a href="../Rails.html">Rails</a>
application.</p>

<p>For an outline of what Active Resource is capable of, see its <a
href="../files/activeresource/README_rdoc.html">README</a>.</p>

<h2 id="label-Automated+mapping">Automated mapping</h2>

<p>Active Resource objects represent your RESTful resources as manipulatable
Ruby objects.  To map resources to Ruby objects, Active Resource only needs
a class name that corresponds to the resource name (e.g., the class Person
maps to the resources people, very similarly to Active Record) and a
<code>site</code> value, which holds the <a href="../URI.html">URI</a> of
the resources.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Person</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">site</span> = <span class="ruby-string">&quot;http://api.people.com:3000/&quot;</span>
<span class="ruby-keyword">end</span>
</pre>

<p>Now the Person class is mapped to RESTful resources located at
<code>http://api.people.com:3000/people/</code>, and you can now use Active
Resource’s life cycle methods to manipulate resources. In the case where
you already have an existing model with the same name as the desired
RESTful resource you can set the <code>element_name</code> value.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">PersonResource</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">site</span> = <span class="ruby-string">&quot;http://api.people.com:3000/&quot;</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">element_name</span> = <span class="ruby-string">&quot;person&quot;</span>
<span class="ruby-keyword">end</span>
</pre>

<p>If your Active Resource object is required to use an HTTP proxy you can set
the <code>proxy</code> value which holds a <a href="../URI.html">URI</a>.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">PersonResource</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">site</span> = <span class="ruby-string">&quot;http://api.people.com:3000/&quot;</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">proxy</span> = <span class="ruby-string">&quot;http://user:password@proxy.people.com:8080&quot;</span>
<span class="ruby-keyword">end</span>
</pre>

<h2 id="label-Life+cycle+methods">Life cycle methods</h2>

<p>Active Resource exposes methods for creating, finding, updating, and
deleting resources from REST web services.</p>

<pre class="ruby"><span class="ruby-identifier">ryan</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">first</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Ryan'</span>, :<span class="ruby-identifier">last</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Daigle'</span>)
<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">save</span>                <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">id</span>                  <span class="ruby-comment"># =&gt; 2</span>
<span class="ruby-constant">Person</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">id</span>)  <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">exists?</span>             <span class="ruby-comment"># =&gt; true</span>

<span class="ruby-identifier">ryan</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>)
<span class="ruby-comment"># Resource holding our newly created Person object</span>

<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">first</span> = <span class="ruby-string">'Rizzle'</span>
<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">save</span>                <span class="ruby-comment"># =&gt; true</span>

<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">destroy</span>             <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>As you can see, these are very similar to Active Record’s life cycle
methods for database records. You can read more about each of these methods
in their respective documentation.</p>

<h3 id="label-Custom+REST+methods">Custom REST methods</h3>

<p>Since simple CRUD/life cycle methods can’t accomplish every task, Active
Resource also supports defining your own custom REST methods. To invoke
them, Active Resource provides the <code>get</code>, <code>post</code>,
<code>put</code> and <code>\delete</code> methods where you can specify a
custom REST method name to invoke.</p>

<pre class="ruby"><span class="ruby-comment"># POST to the custom 'register' REST method, i.e. POST /people/new/register.json.</span>
<span class="ruby-constant">Person</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Ryan'</span>).<span class="ruby-identifier">post</span>(:<span class="ruby-identifier">register</span>)
<span class="ruby-comment"># =&gt; { :id =&gt; 1, :name =&gt; 'Ryan', :position =&gt; 'Clerk' }</span>

<span class="ruby-comment"># PUT an update by invoking the 'promote' REST method, i.e. PUT /people/1/promote.json?position=Manager.</span>
<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>).<span class="ruby-identifier">put</span>(:<span class="ruby-identifier">promote</span>, :<span class="ruby-identifier">position</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Manager'</span>)
<span class="ruby-comment"># =&gt; { :id =&gt; 1, :name =&gt; 'Ryan', :position =&gt; 'Manager' }</span>

<span class="ruby-comment"># GET all the positions available, i.e. GET /people/positions.json.</span>
<span class="ruby-constant">Person</span>.<span class="ruby-identifier">get</span>(:<span class="ruby-identifier">positions</span>)
<span class="ruby-comment"># =&gt; [{:name =&gt; 'Manager'}, {:name =&gt; 'Clerk'}]</span>

<span class="ruby-comment"># DELETE to 'fire' a person, i.e. DELETE /people/1/fire.json.</span>
<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>).<span class="ruby-identifier">delete</span>(:<span class="ruby-identifier">fire</span>)
</pre>

<p>For more information on using custom REST methods, see the <a
href="CustomMethods.html">ActiveResource::CustomMethods</a> documentation.</p>

<h2 id="label-Validations"><a href="Validations.html">Validations</a></h2>

<p>You can validate resources client side by overriding validation methods in
the base class.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Person</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
   <span class="ruby-keyword">self</span>.<span class="ruby-identifier">site</span> = <span class="ruby-string">&quot;http://api.people.com:3000/&quot;</span>
   <span class="ruby-identifier">protected</span>
     <span class="ruby-keyword">def</span> <span class="ruby-identifier">validate</span>
       <span class="ruby-identifier">errors</span>.<span class="ruby-identifier">add</span>(<span class="ruby-string">&quot;last&quot;</span>, <span class="ruby-string">&quot;has invalid characters&quot;</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">last</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r[a-zA-Z]*/</span>
     <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

<p>See the <a href="Validations.html">ActiveResource::Validations</a>
documentation for more information.</p>

<h2 id="label-Authentication">Authentication</h2>

<p>Many REST APIs will require authentication, usually in the form of basic
HTTP authentication.  Authentication can be specified by:</p>

<h3 id="label-HTTP+Basic+Authentication">HTTP Basic Authentication</h3>
<ul><li>
<p>putting the credentials in the URL for the <code>site</code> variable.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Person</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">site</span> = <span class="ruby-string">&quot;http://ryan:password@api.people.com:3000/&quot;</span>
<span class="ruby-keyword">end</span>
</pre>
</li><li>
<p>defining <code>user</code> and/or <code>password</code> variables</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Person</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">site</span> = <span class="ruby-string">&quot;http://api.people.com:3000/&quot;</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">user</span> = <span class="ruby-string">&quot;ryan&quot;</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">password</span> = <span class="ruby-string">&quot;password&quot;</span>
<span class="ruby-keyword">end</span>
</pre>
</li></ul>

<p>For obvious security reasons, it is probably best if such services are
available over HTTPS.</p>

<p>Note: Some values cannot be provided in the URL passed to site.  e.g. email
addresses as usernames.  In those situations you should use the separate
user and password option.</p>

<h3 id="label-Certificate+Authentication">Certificate Authentication</h3>
<ul><li>
<p>End point uses an X509 certificate for authentication. <code>See
ssl_options=</code> for all options.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Person</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">site</span> = <span class="ruby-string">&quot;https://secure.api.people.com/&quot;</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">ssl_options</span> = {:<span class="ruby-identifier">cert</span>         =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">X509</span><span class="ruby-operator">::</span><span class="ruby-constant">Certificate</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">pem_file</span>))
                      :<span class="ruby-identifier">key</span>          =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">pem_file</span>)),
                      :<span class="ruby-identifier">ca_path</span>      =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;/path/to/OpenSSL/formatted/CA_Certs&quot;</span>,
                      :<span class="ruby-identifier">verify_mode</span>  =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERIFY_PEER</span>}
<span class="ruby-keyword">end</span>
</pre>
</li></ul>

<h2 id="label-Errors+%26+Validation"><a href="Errors.html">Errors</a> &amp; Validation</h2>

<p>Error handling and validation is handled in much the same manner as you’re
used to seeing in Active Record.  Both the response code in the HTTP
response and the body of the response are used to indicate that an error
occurred.</p>

<h3 id="label-Resource+errors">Resource errors</h3>

<p>When a GET is requested for a resource that does not exist, the HTTP
<code>404</code> (Resource Not Found) response code will be returned from
the server which will raise an ActiveResource::ResourceNotFound exception.</p>

<pre># GET http://api.people.com:3000/people/999.json
ryan = Person.find(999) # 404, raises ActiveResource::ResourceNotFound</pre>

<p><code>404</code> is just one of the HTTP error response codes that Active
Resource will handle with its own exception. The following HTTP response
codes will also result in these exceptions:</p>
<ul><li>
<p>200..399 - Valid response. No exceptions, other than these redirects:</p>
</li><li>
<p>301, 302, 303, 307 - ActiveResource::Redirection</p>
</li><li>
<p>400 - ActiveResource::BadRequest</p>
</li><li>
<p>401 - ActiveResource::UnauthorizedAccess</p>
</li><li>
<p>403 - ActiveResource::ForbiddenAccess</p>
</li><li>
<p>404 - ActiveResource::ResourceNotFound</p>
</li><li>
<p>405 - ActiveResource::MethodNotAllowed</p>
</li><li>
<p>409 - ActiveResource::ResourceConflict</p>
</li><li>
<p>410 - ActiveResource::ResourceGone</p>
</li><li>
<p>422 - ActiveResource::ResourceInvalid (rescued by save as validation
errors)</p>
</li><li>
<p>401..499 - ActiveResource::ClientError</p>
</li><li>
<p>500..599 - ActiveResource::ServerError</p>
</li><li>
<p>Other - ActiveResource::ConnectionError</p>
</li></ul>

<p>These custom exceptions allow you to deal with resource errors more
naturally and with more precision rather than returning a general HTTP
error.  For example:</p>

<pre class="ruby"><span class="ruby-keyword">begin</span>
  <span class="ruby-identifier">ryan</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">my_id</span>)
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">ResourceNotFound</span>
  <span class="ruby-identifier">redirect_to</span> :<span class="ruby-identifier">action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'not_found'</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">ResourceConflict</span>, <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">ResourceInvalid</span>
  <span class="ruby-identifier">redirect_to</span> :<span class="ruby-identifier">action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'new'</span>
<span class="ruby-keyword">end</span>
</pre>

<p>When a GET is requested for a nested resource and you don’t provide the
prefix_param an ActiveResource::MissingPrefixParam will be raised.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Comment</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">site</span> = <span class="ruby-string">&quot;http://someip.com/posts/:post_id/&quot;</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">Comment</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>)
<span class="ruby-comment"># =&gt; ActiveResource::MissingPrefixParam: post_id prefix_option is missing</span>
</pre>

<h3 id="label-Validation+errors">Validation errors</h3>

<p>Active Resource supports validations on resources and will return errors if
any of these validations fail (e.g., “First name can not be blank” and so
on).  These types of errors are denoted in the response by a response code
of <code>422</code> and an XML or JSON representation of the validation
errors.  The save operation will then fail (with a <code>false</code>
return value) and the validation errors can be accessed on the resource in
question.</p>

<pre class="ruby"><span class="ruby-identifier">ryan</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>)
<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">first</span> <span class="ruby-comment"># =&gt; ''</span>
<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">save</span>  <span class="ruby-comment"># =&gt; false</span>

<span class="ruby-comment"># When</span>
<span class="ruby-comment"># PUT http://api.people.com:3000/people/1.json</span>
<span class="ruby-comment"># or</span>
<span class="ruby-comment"># PUT http://api.people.com:3000/people/1.json</span>
<span class="ruby-comment"># is requested with invalid values, the response is:</span>
<span class="ruby-comment">#</span>
<span class="ruby-comment"># Response (422):</span>
<span class="ruby-comment"># &lt;errors&gt;&lt;error&gt;First cannot be empty&lt;/error&gt;&lt;/errors&gt;</span>
<span class="ruby-comment"># or</span>
<span class="ruby-comment"># {&quot;errors&quot;:[&quot;First cannot be empty&quot;]}</span>
<span class="ruby-comment">#</span>

<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">invalid?</span>(:<span class="ruby-identifier">first</span>)  <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">full_messages</span>     <span class="ruby-comment"># =&gt; ['First cannot be empty']</span>
</pre>

<p>Learn more about Active Resource’s validation features in the <a
href="Validations.html">ActiveResource::Validations</a> documentation.</p>

<h3 id="label-Timeouts">Timeouts</h3>

<p>Active Resource relies on HTTP to access RESTful APIs and as such is
inherently susceptible to slow or unresponsive servers. In such cases, your
Active Resource method calls could timeout. You can control the amount of
time before Active Resource times out with the <code>timeout</code>
variable.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Person</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">site</span> = <span class="ruby-string">&quot;http://api.people.com:3000/&quot;</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">timeout</span> = <span class="ruby-value">5</span>
<span class="ruby-keyword">end</span>
</pre>

<p>This sets the <code>timeout</code> to 5 seconds. You can adjust the
<code>timeout</code> to a value suitable for the RESTful API you are
accessing. It is recommended to set this to a reasonably low value to allow
your Active Resource clients (especially if you are using Active Resource
in a <a href="../Rails.html">Rails</a> application) to fail-fast (see <a
href="http://en.wikipedia.org/wiki/Fail-fast">en.wikipedia.org/wiki/Fail-fast</a>)
rather than cause cascading failures that could incapacitate your server.</p>

<p>When a timeout occurs, an <a
href="TimeoutError.html">ActiveResource::TimeoutError</a> is raised. You
should rescue from <a
href="TimeoutError.html">ActiveResource::TimeoutError</a> in your Active
Resource method calls.</p>

<p>Internally, Active Resource relies on Ruby’s Net::HTTP library to make HTTP
requests. Setting <code>timeout</code> sets the <code>read_timeout</code>
of the internal Net::HTTP instance to the same value. The default
<code>read_timeout</code> is 60 seconds on most Ruby implementations.</p>

  </div><!-- description -->

  
  
  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    
    <!-- Attributes -->
    <section id="attribute-method-details" class="method-section section">
      <h3 class="section-header">Attributes</h3>

      
      <div id="attribute-c-collection_name" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">collection_name</span><span
            class="attribute-access-type">[W]</span>
        </div>

        <div class="method-description">
        
        
        
        </div>
      </div>
      
      <div id="attribute-c-element_name" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">element_name</span><span
            class="attribute-access-type">[W]</span>
        </div>

        <div class="method-description">
        
        
        
        </div>
      </div>
      
      <div id="attribute-c-primary_key" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">primary_key</span><span
            class="attribute-access-type">[W]</span>
        </div>

        <div class="method-description">
        
        
        
        </div>
      </div>
      
      <div id="attribute-c-set_collection_name" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">set_collection_name</span><span
            class="attribute-access-type">[W]</span>
        </div>

        <div class="method-description">
        
        
        
        </div>
      </div>
      
      <div id="attribute-c-set_element_name" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">set_element_name</span><span
            class="attribute-access-type">[W]</span>
        </div>

        <div class="method-description">
        
        
        
        </div>
      </div>
      
      <div id="attribute-c-set_primary_key" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">set_primary_key</span><span
            class="attribute-access-type">[W]</span>
        </div>

        <div class="method-description">
        
        
        
        </div>
      </div>
      
    </section><!-- attribute-method-details -->
    

    <!-- Methods -->
    
     <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
      <h3 class="section-header">Public Class Methods</h3>

    
      <div id="method-c-all" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">all</span><span
            class="method-args">(*args)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>This is an alias for find(:all).  You can pass in all the same arguments to
this method as you can to <code>find(:all)</code></p>
          

          
          <div class="method-source-code" id="all-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 838</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">all</span>(*<span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">find</span>(<span class="ruby-value">:all</span>, *<span class="ruby-identifier">args</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- all-source -->
          
        </div>

        

        
      </div><!-- all-method -->

    
      <div id="method-c-auth_type" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">auth_type</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="auth_type-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 471</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">auth_type</span>
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-ivar">@auth_type</span>)
    <span class="ruby-ivar">@auth_type</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- auth_type-source -->
          
        </div>

        

        
      </div><!-- auth_type-method -->

    
      <div id="method-c-auth_type-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">auth_type=</span><span
            class="method-args">(auth_type)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="auth_type-3D-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 477</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">auth_type=</span>(<span class="ruby-identifier">auth_type</span>)
  <span class="ruby-ivar">@connection</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@auth_type</span> = <span class="ruby-identifier">auth_type</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- auth_type-3D-source -->
          
        </div>

        

        
      </div><!-- auth_type-3D-method -->

    
      <div id="method-c-build" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">build</span><span
            class="method-args">(attributes = {})</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Builds a new, unsaved record using the default values from the remote
server so that it can be used with RESTful forms.</p>

<h4 id="method-c-build-label-Options">Options</h4>
<ul><li>
<p><code>attributes</code> - A hash that overrides the default values from the
server.</p>
</li></ul>

<p>Returns the new resource instance.</p>
          

          
          <div class="method-source-code" id="build-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 716</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">build</span>(<span class="ruby-identifier">attributes</span> = {})
  <span class="ruby-identifier">attrs</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">format</span>.<span class="ruby-identifier">decode</span>(<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;#{new_element_path}&quot;</span>).<span class="ruby-identifier">body</span>).<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">attributes</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">attrs</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- build-source -->
          
        </div>

        

        
      </div><!-- build-method -->

    
      <div id="method-c-collection_name" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">collection_name</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="collection_name-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 574</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">collection_name</span>
  <span class="ruby-ivar">@collection_name</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflector</span>.<span class="ruby-identifier">pluralize</span>(<span class="ruby-identifier">element_name</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- collection_name-source -->
          
        </div>

        

        
      </div><!-- collection_name-method -->

    
      <div id="method-c-collection_path" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">collection_path</span><span
            class="method-args">(prefix_options = {}, query_options = nil)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Gets the collection path for the REST resources.  If the
<code>query_options</code> parameter is omitted, <a
href="../Rails.html">Rails</a> will split from the
<code>prefix_options</code>.</p>

<h4 id="method-c-collection_path-label-Options">Options</h4>
<ul><li>
<p><code>prefix_options</code> - A hash to add a prefix to the request for
nested URLs (e.g., <code>:account_id =&gt; 19</code> would yield a URL like
<code>/accounts/19/purchases.json</code>).</p>
</li><li>
<p><code>query_options</code> - A hash to add items to the query string for
the request.</p>
</li></ul>

<h4 id="method-c-collection_path-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-constant">Post</span>.<span class="ruby-identifier">collection_path</span>
<span class="ruby-comment"># =&gt; /posts.json</span>

<span class="ruby-constant">Comment</span>.<span class="ruby-identifier">collection_path</span>(:<span class="ruby-identifier">post_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5</span>)
<span class="ruby-comment"># =&gt; /posts/5/comments.json</span>

<span class="ruby-constant">Comment</span>.<span class="ruby-identifier">collection_path</span>(:<span class="ruby-identifier">post_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5</span>, :<span class="ruby-identifier">active</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>)
<span class="ruby-comment"># =&gt; /posts/5/comments.json?active=1</span>

<span class="ruby-constant">Comment</span>.<span class="ruby-identifier">collection_path</span>({:<span class="ruby-identifier">post_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5</span>}, {:<span class="ruby-identifier">active</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>})
<span class="ruby-comment"># =&gt; /posts/5/comments.json?active=1</span>
</pre>
          

          
          <div class="method-source-code" id="collection_path-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 700</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">collection_path</span>(<span class="ruby-identifier">prefix_options</span> = {}, <span class="ruby-identifier">query_options</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">check_prefix_options</span>(<span class="ruby-identifier">prefix_options</span>)
  <span class="ruby-identifier">prefix_options</span>, <span class="ruby-identifier">query_options</span> = <span class="ruby-identifier">split_options</span>(<span class="ruby-identifier">prefix_options</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">query_options</span>.<span class="ruby-identifier">nil?</span>
  <span class="ruby-node">&quot;#{prefix(prefix_options)}#{collection_name}.#{format.extension}#{query_string(query_options)}&quot;</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- collection_path-source -->
          
        </div>

        

        
      </div><!-- collection_path-method -->

    
      <div id="method-c-connection" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">connection</span><span
            class="method-args">(refresh = false)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>An instance of <a href="Connection.html">ActiveResource::Connection</a>
that is the base connection to the remote service. The <code>refresh</code>
parameter toggles whether or not the connection is refreshed at every
request or not (defaults to <code>false</code>).</p>
          

          
          <div class="method-source-code" id="connection-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 547</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">connection</span>(<span class="ruby-identifier">refresh</span> = <span class="ruby-keyword">false</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-ivar">@connection</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">superclass</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Object</span>
    <span class="ruby-ivar">@connection</span> = <span class="ruby-constant">Connection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">site</span>, <span class="ruby-identifier">format</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">refresh</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">proxy</span> = <span class="ruby-identifier">proxy</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">proxy</span>
    <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">user</span> = <span class="ruby-identifier">user</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">user</span>
    <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">password</span> = <span class="ruby-identifier">password</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">password</span>
    <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">auth_type</span> = <span class="ruby-identifier">auth_type</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">auth_type</span>
    <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">timeout</span> = <span class="ruby-identifier">timeout</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">timeout</span>
    <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">ssl_options</span> = <span class="ruby-identifier">ssl_options</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ssl_options</span>
    <span class="ruby-ivar">@connection</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">connection</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- connection-source -->
          
        </div>

        

        
      </div><!-- connection-method -->

    
      <div id="method-c-create" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create</span><span
            class="method-args">(attributes = {})</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Creates a new resource instance and makes a request to the remote service
that it be saved, making it equivalent to the following simultaneous calls:</p>

<pre class="ruby"><span class="ruby-identifier">ryan</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">first</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'ryan'</span>)
<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">save</span>
</pre>

<p>Returns the newly created resource.  If a failure has occurred an exception
will be raised (see <code>save</code>).  If the resource is invalid and has
not been saved then <code>valid?</code> will return <code>false</code>,
while <code>new?</code> will still return <code>true</code>.</p>

<h4 id="method-c-create-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-constant">Person</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Jeremy'</span>, :<span class="ruby-identifier">email</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'myname@nospam.com'</span>, :<span class="ruby-identifier">enabled</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span>)
<span class="ruby-identifier">my_person</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">first</span>)
<span class="ruby-identifier">my_person</span>.<span class="ruby-identifier">email</span> <span class="ruby-comment"># =&gt; myname@nospam.com</span>

<span class="ruby-identifier">dhh</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'David'</span>, :<span class="ruby-identifier">email</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'dhh@nospam.com'</span>, :<span class="ruby-identifier">enabled</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span>)
<span class="ruby-identifier">dhh</span>.<span class="ruby-identifier">valid?</span> <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-identifier">dhh</span>.<span class="ruby-identifier">new?</span>   <span class="ruby-comment"># =&gt; false</span>

<span class="ruby-comment"># We'll assume that there's a validation that requires the name attribute</span>
<span class="ruby-identifier">that_guy</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">''</span>, :<span class="ruby-identifier">email</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'thatguy@nospam.com'</span>, :<span class="ruby-identifier">enabled</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span>)
<span class="ruby-identifier">that_guy</span>.<span class="ruby-identifier">valid?</span> <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-identifier">that_guy</span>.<span class="ruby-identifier">new?</span>   <span class="ruby-comment"># =&gt; true</span>
</pre>
          

          
          <div class="method-source-code" id="create-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 745</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create</span>(<span class="ruby-identifier">attributes</span> = {})
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">attributes</span>).<span class="ruby-identifier">tap</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">resource</span><span class="ruby-operator">|</span> <span class="ruby-identifier">resource</span>.<span class="ruby-identifier">save</span> }
<span class="ruby-keyword">end</span></pre>
          </div><!-- create-source -->
          
        </div>

        

        
      </div><!-- create-method -->

    
      <div id="method-c-delete" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">delete</span><span
            class="method-args">(id, options = {})</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Deletes the resources with the ID in the <code>id</code> parameter.</p>

<h4 id="method-c-delete-label-Options">Options</h4>

<p>All options specify prefix and query parameters.</p>

<h4 id="method-c-delete-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-constant">Event</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">2</span>) <span class="ruby-comment"># sends DELETE /events/2</span>

<span class="ruby-constant">Event</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Free Concert'</span>, :<span class="ruby-identifier">location</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Community Center'</span>)
<span class="ruby-identifier">my_event</span> = <span class="ruby-constant">Event</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">first</span>) <span class="ruby-comment"># let's assume this is event with ID 7</span>
<span class="ruby-constant">Event</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">my_event</span>.<span class="ruby-identifier">id</span>) <span class="ruby-comment"># sends DELETE /events/7</span>

<span class="ruby-comment"># Let's assume a request to events/5/cancel.json</span>
<span class="ruby-constant">Event</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">params</span>[:<span class="ruby-identifier">id</span>]) <span class="ruby-comment"># sends DELETE /events/5</span>
</pre>
          

          
          <div class="method-source-code" id="delete-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 857</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">element_path</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">options</span>))
<span class="ruby-keyword">end</span></pre>
          </div><!-- delete-source -->
          
        </div>

        

        
      </div><!-- delete-method -->

    
      <div id="method-c-element_name" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">element_name</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="element_name-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 568</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">element_name</span>
  <span class="ruby-ivar">@element_name</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">model_name</span>.<span class="ruby-identifier">element</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- element_name-source -->
          
        </div>

        

        
      </div><!-- element_name-method -->

    
      <div id="method-c-element_path" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">element_path</span><span
            class="method-args">(id, prefix_options = {}, query_options = nil)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Gets the element path for the given ID in <code>id</code>.  If the
<code>query_options</code> parameter is omitted, <a
href="../Rails.html">Rails</a> will split from the prefix options.</p>

<h4 id="method-c-element_path-label-Options">Options</h4>

<p><code>prefix_options</code> - A hash to add a prefix to the request for
nested URLs (e.g., <code>:account_id =&gt; 19</code></p>

<pre>would yield a URL like &lt;tt&gt;/accounts/19/purchases.json&lt;/tt&gt;).</pre>

<p><code>query_options</code> - A hash to add items to the query string for
the request.</p>

<h4 id="method-c-element_path-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-constant">Post</span>.<span class="ruby-identifier">element_path</span>(<span class="ruby-value">1</span>)
<span class="ruby-comment"># =&gt; /posts/1.json</span>

<span class="ruby-keyword">class</span> <span class="ruby-constant">Comment</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">site</span> = <span class="ruby-string">&quot;http://37s.sunrise.i/posts/:post_id/&quot;</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">Comment</span>.<span class="ruby-identifier">element_path</span>(<span class="ruby-value">1</span>, :<span class="ruby-identifier">post_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5</span>)
<span class="ruby-comment"># =&gt; /posts/5/comments/1.json</span>

<span class="ruby-constant">Comment</span>.<span class="ruby-identifier">element_path</span>(<span class="ruby-value">1</span>, :<span class="ruby-identifier">post_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5</span>, :<span class="ruby-identifier">active</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>)
<span class="ruby-comment"># =&gt; /posts/5/comments/1.json?active=1</span>

<span class="ruby-constant">Comment</span>.<span class="ruby-identifier">element_path</span>(<span class="ruby-value">1</span>, {:<span class="ruby-identifier">post_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5</span>}, {:<span class="ruby-identifier">active</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>})
<span class="ruby-comment"># =&gt; /posts/5/comments/1.json?active=1</span>
</pre>
          

          
          <div class="method-source-code" id="element_path-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 652</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">element_path</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">prefix_options</span> = {}, <span class="ruby-identifier">query_options</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">check_prefix_options</span>(<span class="ruby-identifier">prefix_options</span>)

  <span class="ruby-identifier">prefix_options</span>, <span class="ruby-identifier">query_options</span> = <span class="ruby-identifier">split_options</span>(<span class="ruby-identifier">prefix_options</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">query_options</span>.<span class="ruby-identifier">nil?</span>
  <span class="ruby-node">&quot;#{prefix(prefix_options)}#{collection_name}/#{URI.parser.escape id.to_s}.#{format.extension}#{query_string(query_options)}&quot;</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- element_path-source -->
          
        </div>

        

        
      </div><!-- element_path-method -->

    
      <div id="method-c-exists-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">exists?</span><span
            class="method-args">(id, options = {})</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Asserts the existence of a resource, returning <code>true</code> if the
resource is found.</p>

<h4 id="method-c-exists-3F-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-constant">Note</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">title</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Hello, world.'</span>, :<span class="ruby-identifier">body</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Nothing more for now...'</span>)
<span class="ruby-constant">Note</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-value">1</span>) <span class="ruby-comment"># =&gt; true</span>

<span class="ruby-constant">Note</span>.<span class="ruby-identifier">exists</span>(<span class="ruby-value">1349</span>) <span class="ruby-comment"># =&gt; false</span>
</pre>
          

          
          <div class="method-source-code" id="exists-3F-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 868</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">id</span>
    <span class="ruby-identifier">prefix_options</span>, <span class="ruby-identifier">query_options</span> = <span class="ruby-identifier">split_options</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:params</span>])
    <span class="ruby-identifier">path</span> = <span class="ruby-identifier">element_path</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">prefix_options</span>, <span class="ruby-identifier">query_options</span>)
    <span class="ruby-identifier">response</span> = <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">head</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">headers</span>)
    <span class="ruby-identifier">response</span>.<span class="ruby-identifier">code</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">==</span> <span class="ruby-value">200</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-comment"># id &amp;&amp; !find_single(id, options).nil?</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">ResourceNotFound</span>, <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">ResourceGone</span>
  <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- exists-3F-source -->
          
        </div>

        

        
      </div><!-- exists-3F-method -->

    
      <div id="method-c-find" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">find</span><span
            class="method-args">(*arguments)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Core method for finding resources.  Used similarly to Active Record’s
<code>find</code> method.</p>

<h4 id="method-c-find-label-Arguments">Arguments</h4>

<p>The first argument is considered to be the scope of the query.  That is,
how many resources are returned from the request.  It can be one of the
following.</p>
<ul><li>
<p><code>:one</code> - Returns a single resource.</p>
</li><li>
<p><code>:first</code> - Returns the first resource found.</p>
</li><li>
<p><code>:last</code> - Returns the last resource found.</p>
</li><li>
<p><code>:all</code> - Returns every resource that matches the request.</p>
</li></ul>

<h4 id="method-c-find-label-Options">Options</h4>
<ul><li>
<p><code>:from</code> - Sets the path or custom method that resources will be
fetched from.</p>
</li><li>
<p><code>:params</code> - Sets query and prefix (nested URL) parameters.</p>
</li></ul>

<h4 id="method-c-find-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>)
<span class="ruby-comment"># =&gt; GET /people/1.json</span>

<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">all</span>)
<span class="ruby-comment"># =&gt; GET /people.json</span>

<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">all</span>, :<span class="ruby-identifier">params</span> =<span class="ruby-operator">&gt;</span> { :<span class="ruby-identifier">title</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;CEO&quot;</span> })
<span class="ruby-comment"># =&gt; GET /people.json?title=CEO</span>

<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">first</span>, :<span class="ruby-identifier">from</span> =<span class="ruby-operator">&gt;</span> :<span class="ruby-identifier">managers</span>)
<span class="ruby-comment"># =&gt; GET /people/managers.json</span>

<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">last</span>, :<span class="ruby-identifier">from</span> =<span class="ruby-operator">&gt;</span> :<span class="ruby-identifier">managers</span>)
<span class="ruby-comment"># =&gt; GET /people/managers.json</span>

<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">all</span>, :<span class="ruby-identifier">from</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;/companies/1/people.json&quot;</span>)
<span class="ruby-comment"># =&gt; GET /companies/1/people.json</span>

<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">one</span>, :<span class="ruby-identifier">from</span> =<span class="ruby-operator">&gt;</span> :<span class="ruby-identifier">leader</span>)
<span class="ruby-comment"># =&gt; GET /people/leader.json</span>

<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">all</span>, :<span class="ruby-identifier">from</span> =<span class="ruby-operator">&gt;</span> :<span class="ruby-identifier">developers</span>, :<span class="ruby-identifier">params</span> =<span class="ruby-operator">&gt;</span> { :<span class="ruby-identifier">language</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'ruby'</span> })
<span class="ruby-comment"># =&gt; GET /people/developers.json?language=ruby</span>

<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">one</span>, :<span class="ruby-identifier">from</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;/companies/1/manager.json&quot;</span>)
<span class="ruby-comment"># =&gt; GET /companies/1/manager.json</span>

<span class="ruby-constant">StreetAddress</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>, :<span class="ruby-identifier">params</span> =<span class="ruby-operator">&gt;</span> { :<span class="ruby-identifier">person_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span> })
<span class="ruby-comment"># =&gt; GET /people/1/street_addresses/1.json</span>
</pre>

<h2 id="method-c-find-label-Failure+or+missing+data">Failure or missing data</h2>

<pre class="ruby"><span class="ruby-constant">A</span> <span class="ruby-identifier">failure</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">find</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">requested</span> <span class="ruby-identifier">object</span> <span class="ruby-identifier">raises</span> <span class="ruby-identifier">a</span> <span class="ruby-constant">ResourceNotFound</span>
<span class="ruby-identifier">exception</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">find</span> <span class="ruby-identifier">was</span> <span class="ruby-identifier">called</span> <span class="ruby-identifier">with</span> <span class="ruby-identifier">an</span> <span class="ruby-identifier">id</span>.
<span class="ruby-constant">With</span> <span class="ruby-identifier">any</span> <span class="ruby-identifier">other</span> <span class="ruby-identifier">scope</span>, <span class="ruby-identifier">find</span> <span class="ruby-identifier">returns</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">when</span> <span class="ruby-identifier">no</span> <span class="ruby-identifier">data</span> <span class="ruby-identifier">is</span> <span class="ruby-identifier">returned</span>.

<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>)
<span class="ruby-comment"># =&gt; raises ResourceNotFound</span>

<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">all</span>)
<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">first</span>)
<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">last</span>)
<span class="ruby-comment"># =&gt; nil</span>
</pre>
          

          
          <div class="method-source-code" id="find-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 808</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find</span>(*<span class="ruby-identifier">arguments</span>)
  <span class="ruby-identifier">scope</span>   = <span class="ruby-identifier">arguments</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>)
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">arguments</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>) <span class="ruby-operator">||</span> {}

  <span class="ruby-keyword">case</span> <span class="ruby-identifier">scope</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:all</span>   <span class="ruby-keyword">then</span> <span class="ruby-identifier">find_every</span>(<span class="ruby-identifier">options</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">:first</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">find_every</span>(<span class="ruby-identifier">options</span>).<span class="ruby-identifier">first</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:last</span>  <span class="ruby-keyword">then</span> <span class="ruby-identifier">find_every</span>(<span class="ruby-identifier">options</span>).<span class="ruby-identifier">last</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:one</span>   <span class="ruby-keyword">then</span> <span class="ruby-identifier">find_one</span>(<span class="ruby-identifier">options</span>)
    <span class="ruby-keyword">else</span>             <span class="ruby-identifier">find_single</span>(<span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- find-source -->
          
        </div>

        

        
      </div><!-- find-method -->

    
      <div id="method-c-first" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">first</span><span
            class="method-args">(*args)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>A convenience wrapper for <code>find(:first, *args)</code>. You can pass in
all the same arguments to this method as you can to
<code>find(:first)</code>.</p>
          

          
          <div class="method-source-code" id="first-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 825</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">first</span>(*<span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">find</span>(<span class="ruby-value">:first</span>, *<span class="ruby-identifier">args</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- first-source -->
          
        </div>

        

        
      </div><!-- first-method -->

    
      <div id="method-c-format" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">format</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Returns the current format, default is <a
href="Formats/JsonFormat.html">ActiveResource::Formats::JsonFormat</a>.</p>
          

          
          <div class="method-source-code" id="format-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 500</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">format</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">_format</span> <span class="ruby-operator">||</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Formats</span><span class="ruby-operator">::</span><span class="ruby-constant">JsonFormat</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- format-source -->
          
        </div>

        

        
      </div><!-- format-method -->

    
      <div id="method-c-format-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">format=</span><span
            class="method-args">(mime_type_reference_or_format)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Sets the format that attributes are sent and received in from a mime type
reference:</p>

<pre class="ruby"><span class="ruby-constant">Person</span>.<span class="ruby-identifier">format</span> = :<span class="ruby-identifier">json</span>
<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>) <span class="ruby-comment"># =&gt; GET /people/1.json</span>

<span class="ruby-constant">Person</span>.<span class="ruby-identifier">format</span> = <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Formats</span><span class="ruby-operator">::</span><span class="ruby-constant">XmlFormat</span>
<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>) <span class="ruby-comment"># =&gt; GET /people/1.xml</span>
</pre>

<p>Default format is <code>:json</code>.</p>
          

          
          <div class="method-source-code" id="format-3D-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 491</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">format=</span>(<span class="ruby-identifier">mime_type_reference_or_format</span>)
  <span class="ruby-identifier">format</span> = <span class="ruby-identifier">mime_type_reference_or_format</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-operator">?</span>
    <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Formats</span>[<span class="ruby-identifier">mime_type_reference_or_format</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">mime_type_reference_or_format</span>

  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">_format</span> = <span class="ruby-identifier">format</span>
  <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">format</span> = <span class="ruby-identifier">format</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">site</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- format-3D-source -->
          
        </div>

        

        
      </div><!-- format-3D-method -->

    
      <div id="method-c-headers" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">headers</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="headers-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 562</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">headers</span>
  <span class="ruby-ivar">@headers</span> <span class="ruby-operator">||=</span> {}
<span class="ruby-keyword">end</span></pre>
          </div><!-- headers-source -->
          
        </div>

        

        
      </div><!-- headers-method -->

    
      <div id="method-c-known_attributes" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">known_attributes</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Returns the list of known attributes for this resource, gathered from the
provided <code>schema</code> Attributes that are known will cause your
resource to return ‘true’ when <code>respond_to?</code> is called on them.
A known attribute will return nil if not set (rather than
&lt;t&gt;MethodNotFound&lt;/tt&gt;); thus known attributes can be used with
<code>validates_presence_of</code> without a getter-method.</p>
          

          
          <div class="method-source-code" id="known_attributes-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 381</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">known_attributes</span>
  <span class="ruby-ivar">@known_attributes</span> <span class="ruby-operator">||=</span> []
<span class="ruby-keyword">end</span></pre>
          </div><!-- known_attributes-source -->
          
        </div>

        

        
      </div><!-- known_attributes-method -->

    
      <div id="method-c-last" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">last</span><span
            class="method-args">(*args)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>A convenience wrapper for <code>find(:last, *args)</code>. You can pass in
all the same arguments to this method as you can to
<code>find(:last)</code>.</p>
          

          
          <div class="method-source-code" id="last-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 832</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">last</span>(*<span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">find</span>(<span class="ruby-value">:last</span>, *<span class="ruby-identifier">args</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- last-source -->
          
        </div>

        

        
      </div><!-- last-method -->

    
      <div id="method-c-logger" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">logger</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>The logger for diagnosing and tracing Active Resource calls.</p>
          

          
          <div class="method-source-code" id="logger-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 262</span>
<span class="ruby-identifier">cattr_accessor</span> <span class="ruby-value">:logger</span>
</pre>
          </div><!-- logger-source -->
          
        </div>

        

        
      </div><!-- logger-method -->

    
      <div id="method-c-new" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new</span><span
            class="method-args">(attributes = {}, persisted = false)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Constructor method for new resources; the optional <code>attributes</code>
parameter takes a hash of attributes for the new resource.</p>

<h4 id="method-c-new-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-identifier">my_course</span> = <span class="ruby-constant">Course</span>.<span class="ruby-identifier">new</span>
<span class="ruby-identifier">my_course</span>.<span class="ruby-identifier">name</span> = <span class="ruby-string">&quot;Western Civilization&quot;</span>
<span class="ruby-identifier">my_course</span>.<span class="ruby-identifier">lecturer</span> = <span class="ruby-string">&quot;Don Trotter&quot;</span>
<span class="ruby-identifier">my_course</span>.<span class="ruby-identifier">save</span>

<span class="ruby-identifier">my_other_course</span> = <span class="ruby-constant">Course</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;Philosophy: Reason and Being&quot;</span>, :<span class="ruby-identifier">lecturer</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;Ralph Cling&quot;</span>)
<span class="ruby-identifier">my_other_course</span>.<span class="ruby-identifier">save</span>
</pre>
          

          
          <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1002</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attributes</span> = {}, <span class="ruby-identifier">persisted</span> = <span class="ruby-keyword">false</span>)
  <span class="ruby-ivar">@attributes</span>     = {}.<span class="ruby-identifier">with_indifferent_access</span>
  <span class="ruby-ivar">@prefix_options</span> = {}
  <span class="ruby-ivar">@persisted</span> = <span class="ruby-identifier">persisted</span>
  <span class="ruby-identifier">load</span>(<span class="ruby-identifier">attributes</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- new-source -->
          
        </div>

        

        
      </div><!-- new-method -->

    
      <div id="method-c-new_element_path" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new_element_path</span><span
            class="method-args">(prefix_options = {})</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Gets the new element path for REST resources.</p>

<h4 id="method-c-new_element_path-label-Options">Options</h4>
<ul><li>
<p><code>prefix_options</code> - A hash to add a prefix to the request for
nested URLs (e.g., <code>:account_id =&gt; 19</code> would yield a URL like
<code>/accounts/19/purchases/new.json</code>).</p>
</li></ul>

<h4 id="method-c-new_element_path-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-constant">Post</span>.<span class="ruby-identifier">new_element_path</span>
<span class="ruby-comment"># =&gt; /posts/new.json</span>

<span class="ruby-keyword">class</span> <span class="ruby-constant">Comment</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">site</span> = <span class="ruby-string">&quot;http://37s.sunrise.i/posts/:post_id/&quot;</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">Comment</span>.<span class="ruby-identifier">collection_path</span>(:<span class="ruby-identifier">post_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5</span>)
<span class="ruby-comment"># =&gt; /posts/5/comments/new.json</span>
</pre>
          

          
          <div class="method-source-code" id="new_element_path-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 675</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">new_element_path</span>(<span class="ruby-identifier">prefix_options</span> = {})
  <span class="ruby-node">&quot;#{prefix(prefix_options)}#{collection_name}/new.#{format.extension}&quot;</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- new_element_path-source -->
          
        </div>

        

        
      </div><!-- new_element_path-method -->

    
      <div id="method-c-password" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">password</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Gets the password for REST HTTP authentication.</p>
          

          
          <div class="method-source-code" id="password-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 456</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">password</span>
  <span class="ruby-comment"># Not using superclass_delegating_reader. See +site+ for explanation</span>
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-ivar">@password</span>)
    <span class="ruby-ivar">@password</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">superclass</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Object</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">password</span>
    <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">password</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">freeze</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- password-source -->
          
        </div>

        

        
      </div><!-- password-method -->

    
      <div id="method-c-password-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">password=</span><span
            class="method-args">(password)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Sets the password for REST HTTP authentication.</p>
          

          
          <div class="method-source-code" id="password-3D-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 466</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">password=</span>(<span class="ruby-identifier">password</span>)
  <span class="ruby-ivar">@connection</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">password</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- password-3D-source -->
          
        </div>

        

        
      </div><!-- password-3D-method -->

    
      <div id="method-c-prefix" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">prefix</span><span
            class="method-args">(options={})</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Gets the prefix for a resource’s nested URL (e.g.,
<code>prefix/collectionname/1.json</code>) This method is regenerated at
runtime based on what the prefix is set to.</p>
          

          
          <div class="method-source-code" id="prefix-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 586</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">prefix</span>(<span class="ruby-identifier">options</span>={})
  <span class="ruby-identifier">default</span> = <span class="ruby-identifier">site</span>.<span class="ruby-identifier">path</span>
  <span class="ruby-identifier">default</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">'/'</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">default</span>[<span class="ruby-value">-1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">'/'</span>
  <span class="ruby-comment"># generate the actual method based on the current site path</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">prefix</span> = <span class="ruby-identifier">default</span>
  <span class="ruby-identifier">prefix</span>(<span class="ruby-identifier">options</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- prefix-source -->
          
        </div>

        

        
      </div><!-- prefix-method -->

    
      <div id="method-c-prefix-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">prefix=</span><span
            class="method-args">(value = '/')</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Sets the prefix for a resource’s nested URL (e.g.,
<code>prefix/collectionname/1.json</code>). Default value is
<code>site.path</code>.</p>
          

          
          <div class="method-source-code" id="prefix-3D-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 603</span>
      <span class="ruby-keyword">def</span> <span class="ruby-identifier">prefix=</span>(<span class="ruby-identifier">value</span> = <span class="ruby-string">'/'</span>)
        <span class="ruby-comment"># Replace :placeholders with '#{embedded options[:lookups]}'</span>
        <span class="ruby-identifier">prefix_call</span> = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">%r:\w+/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;\#{URI.parser.escape options[#{key}].to_s}&quot;</span> }

        <span class="ruby-comment"># Clear prefix parameters in case they have been cached</span>
        <span class="ruby-ivar">@prefix_parameters</span> = <span class="ruby-keyword">nil</span>

        <span class="ruby-identifier">silence_warnings</span> <span class="ruby-keyword">do</span>
          <span class="ruby-comment"># Redefine the new methods.</span>
          <span class="ruby-identifier">instance_eval</span> <span class="ruby-string">&quot;            def prefix_source() &quot;#{value}&quot; end
            def prefix(options={}) &quot;#{prefix_call}&quot; end
&quot;</span>, <span class="ruby-keyword">__FILE__</span>, <span class="ruby-keyword">__LINE__</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
        <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">&quot;Couldn't set prefix: #{e}\n  #{code}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">logger</span>
        <span class="ruby-identifier">raise</span>
      <span class="ruby-keyword">end</span></pre>
          </div><!-- prefix-3D-source -->
          
        </div>

        
        <div class="aliases">
          Also aliased as: <a href="Base.html#method-c-set_prefix">set_prefix</a>
        </div>
        

        
      </div><!-- prefix-3D-method -->

    
      <div id="method-c-prefix_source" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">prefix_source</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>An attribute reader for the source string for the resource path prefix. 
This method is regenerated at runtime based on what the prefix is set to.</p>
          

          
          <div class="method-source-code" id="prefix_source-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 596</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">prefix_source</span>
  <span class="ruby-identifier">prefix</span> <span class="ruby-comment"># generate #prefix and #prefix_source methods first</span>
  <span class="ruby-identifier">prefix_source</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- prefix_source-source -->
          
        </div>

        

        
      </div><!-- prefix_source-method -->

    
      <div id="method-c-primary_key" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">primary_key</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="primary_key-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 580</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">primary_key</span>
  <span class="ruby-ivar">@primary_key</span> <span class="ruby-operator">||=</span> <span class="ruby-string">'id'</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- primary_key-source -->
          
        </div>

        

        
      </div><!-- primary_key-method -->

    
      <div id="method-c-proxy" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">proxy</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Gets the proxy variable if a proxy is required</p>
          

          
          <div class="method-source-code" id="proxy-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 424</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">proxy</span>
  <span class="ruby-comment"># Not using superclass_delegating_reader. See +site+ for explanation</span>
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-ivar">@proxy</span>)
    <span class="ruby-ivar">@proxy</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">superclass</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Object</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">proxy</span>
    <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">proxy</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">freeze</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- proxy-source -->
          
        </div>

        

        
      </div><!-- proxy-method -->

    
      <div id="method-c-proxy-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">proxy=</span><span
            class="method-args">(proxy)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Sets the <a href="../URI.html">URI</a> of the http proxy to the value in
the <code>proxy</code> argument.</p>
          

          
          <div class="method-source-code" id="proxy-3D-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 434</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">proxy=</span>(<span class="ruby-identifier">proxy</span>)
  <span class="ruby-ivar">@connection</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@proxy</span> = <span class="ruby-identifier">proxy</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">create_proxy_uri_from</span>(<span class="ruby-identifier">proxy</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- proxy-3D-source -->
          
        </div>

        

        
      </div><!-- proxy-3D-method -->

    
      <div id="method-c-schema" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">schema</span><span
            class="method-args">(&block)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Creates a schema for this resource - setting the attributes that are known
prior to fetching an instance from the remote system.</p>

<p>The schema helps define the set of <code>known_attributes</code> of the
current resource.</p>

<p>There is no need to specify a schema for your Active Resource. If you do
not, the <code>known_attributes</code> will be guessed from the instance
attributes returned when an instance is fetched from the remote system.</p>

<p>example: class Person &lt; <a href="Base.html">ActiveResource::Base</a></p>

<pre>schema do
  # define each attribute separately
  attribute 'name', :string

  # or use the convenience methods and pass &gt;=1 attribute names
  string  'eye_color', 'hair_color'
  integer 'age'
  float   'height', 'weight'

  # unsupported types should be left as strings
  # overload the accessor methods if you need to convert them
  attribute 'created_at', 'string'
end</pre>

<p>end</p>

<p>p = Person.new p.respond_to? :name   # =&gt; true p.respond_to? :age    #
=&gt; true p.name                # =&gt; nil p.age                 # =&gt;
nil</p>

<p>j = Person.find_by_name(‘John’) #
&lt;person&gt;&lt;name&gt;John&lt;/name&gt;&lt;age&gt;34&lt;/age&gt;&lt;num_children&gt;3&lt;/num_children&gt;&lt;/person&gt;
j.respond_to? :name   # =&gt; true j.respond_to? :age    # =&gt; true
j.name                # =&gt; ‘John’ j.age                 # =&gt; ‘34’  #
note this is a string! j.num_children        # =&gt; ‘3’  # note this is a
string!</p>

<p>p.num_children        # =&gt; NoMethodError</p>

<p>Attribute-types must be one of:</p>

<pre>string, integer, float</pre>

<p>Note: at present the attribute-type doesn’t do anything, but stay tuned…
Shortly it will also <strong>cast</strong> the value of the returned
attribute. ie: j.age                 # =&gt; 34   # cast to an integer
j.weight              # =&gt; ‘65’ # still a string!</p>
          

          
          <div class="method-source-code" id="schema-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 320</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">schema</span>(&amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-identifier">schema_definition</span> = <span class="ruby-constant">Schema</span>.<span class="ruby-identifier">new</span>
    <span class="ruby-identifier">schema_definition</span>.<span class="ruby-identifier">instance_eval</span>(&amp;<span class="ruby-identifier">block</span>)

    <span class="ruby-comment"># skip out if we didn't define anything</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">schema_definition</span>.<span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">present?</span>

    <span class="ruby-ivar">@schema</span> <span class="ruby-operator">||=</span> {}.<span class="ruby-identifier">with_indifferent_access</span>
    <span class="ruby-ivar">@known_attributes</span> <span class="ruby-operator">||=</span> []

    <span class="ruby-identifier">schema_definition</span>.<span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
      <span class="ruby-ivar">@schema</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
      <span class="ruby-ivar">@known_attributes</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">k</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">schema</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@schema</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- schema-source -->
          
        </div>

        

        
      </div><!-- schema-method -->

    
      <div id="method-c-schema-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">schema=</span><span
            class="method-args">(the_schema)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Alternative, direct way to specify a <code>schema</code> for this Resource.
<code>schema</code> is more flexible, but this is quick for a very simple
schema.</p>

<p>Pass the schema as a hash with the keys being the attribute-names and the
value being one of the accepted attribute types (as defined in
<code>schema</code>)</p>

<p>example:</p>

<p>class Person &lt; <a href="Base.html">ActiveResource::Base</a></p>

<pre class="ruby"><span class="ruby-identifier">schema</span> = {<span class="ruby-string">'name'</span> =<span class="ruby-operator">&gt;</span> :<span class="ruby-identifier">string</span>, <span class="ruby-string">'age'</span> =<span class="ruby-operator">&gt;</span> :<span class="ruby-identifier">integer</span> }
</pre>

<p>end</p>

<p>The keys/values can be strings or symbols. They will be converted to
strings.</p>
          

          
          <div class="method-source-code" id="schema-3D-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 359</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">schema=</span>(<span class="ruby-identifier">the_schema</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">the_schema</span>.<span class="ruby-identifier">present?</span>
    <span class="ruby-comment"># purposefully nulling out the schema</span>
    <span class="ruby-ivar">@schema</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-ivar">@known_attributes</span> = []
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;Expected a hash&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">the_schema</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Hash</span>

  <span class="ruby-identifier">schema</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">the_schema</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">attribute</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>) }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- schema-3D-source -->
          
        </div>

        

        
      </div><!-- schema-3D-method -->

    
      <div id="method-c-set_prefix" class="method-detail method-alias">
        
        <div class="method-heading">
          <span class="method-name">set_prefix</span><span
            class="method-args">(value = '/')</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
        </div>

        

        
        <div class="aliases">
          Alias for: <a href="Base.html#method-c-prefix-3D">prefix=</a>
        </div>
        
      </div><!-- set_prefix-method -->

    
      <div id="method-c-site" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">site</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Gets the <a href="../URI.html">URI</a> of the REST resources to map for
this class.  The site variable is required for Active Resource’s mapping to
work.</p>
          

          
          <div class="method-source-code" id="site-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 387</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">site</span>
  <span class="ruby-comment"># Not using superclass_delegating_reader because don't want subclasses to modify superclass instance</span>
  <span class="ruby-comment">#</span>
  <span class="ruby-comment"># With superclass_delegating_reader</span>
  <span class="ruby-comment">#</span>
  <span class="ruby-comment">#   Parent.site = 'http://anonymous@test.com'</span>
  <span class="ruby-comment">#   Subclass.site # =&gt; 'http://anonymous@test.com'</span>
  <span class="ruby-comment">#   Subclass.site.user = 'david'</span>
  <span class="ruby-comment">#   Parent.site # =&gt; 'http://david@test.com'</span>
  <span class="ruby-comment">#</span>
  <span class="ruby-comment"># Without superclass_delegating_reader (expected behavior)</span>
  <span class="ruby-comment">#</span>
  <span class="ruby-comment">#   Parent.site = 'http://anonymous@test.com'</span>
  <span class="ruby-comment">#   Subclass.site # =&gt; 'http://anonymous@test.com'</span>
  <span class="ruby-comment">#   Subclass.site.user = 'david' # =&gt; TypeError: can't modify frozen object</span>
  <span class="ruby-comment">#</span>
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-ivar">@site</span>)
    <span class="ruby-ivar">@site</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">superclass</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Object</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">site</span>
    <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">site</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">freeze</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- site-source -->
          
        </div>

        

        
      </div><!-- site-method -->

    
      <div id="method-c-site-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">site=</span><span
            class="method-args">(site)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Sets the <a href="../URI.html">URI</a> of the REST resources to map for
this class to the value in the <code>site</code> argument. The site
variable is required for Active Resource’s mapping to work.</p>
          

          
          <div class="method-source-code" id="site-3D-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 412</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">site=</span>(<span class="ruby-identifier">site</span>)
  <span class="ruby-ivar">@connection</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">site</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-ivar">@site</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@site</span> = <span class="ruby-identifier">create_site_uri_from</span>(<span class="ruby-identifier">site</span>)
    <span class="ruby-ivar">@user</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parser</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-ivar">@site</span>.<span class="ruby-identifier">user</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@site</span>.<span class="ruby-identifier">user</span>
    <span class="ruby-ivar">@password</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parser</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-ivar">@site</span>.<span class="ruby-identifier">password</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@site</span>.<span class="ruby-identifier">password</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- site-3D-source -->
          
        </div>

        

        
      </div><!-- site-3D-method -->

    
      <div id="method-c-ssl_options" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">ssl_options</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Returns the SSL options hash.</p>
          

          
          <div class="method-source-code" id="ssl_options-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 536</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">ssl_options</span>
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-ivar">@ssl_options</span>)
    <span class="ruby-ivar">@ssl_options</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">superclass</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Object</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">ssl_options</span>
    <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">ssl_options</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- ssl_options-source -->
          
        </div>

        

        
      </div><!-- ssl_options-method -->

    
      <div id="method-c-ssl_options-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">ssl_options=</span><span
            class="method-args">(opts={})</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Options that will get applied to an SSL connection.</p>
<ul><li>
<p><code>:key</code> - An OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.</p>
</li><li>
<p><code>:cert</code> - An OpenSSL::X509::Certificate object as client
certificate</p>
</li><li>
<p><code>:ca_file</code> - Path to a CA certification file in PEM format. The
file can contain several CA certificates.</p>
</li><li>
<p><code>:ca_path</code> - Path of a CA certification directory containing
certifications in PEM format.</p>
</li><li>
<p><code>:verify_mode</code> - Flags for server the certification verification
at beginning of SSL/TLS session. (OpenSSL::SSL::VERIFY_NONE or
OpenSSL::SSL::VERIFY_PEER is acceptable)</p>
</li><li>
<p><code>:verify_callback</code> - The verify callback for the server
certification verification.</p>
</li><li>
<p><code>:verify_depth</code> - The maximum depth for the certificate chain
verification.</p>
</li><li>
<p><code>:cert_store</code> - OpenSSL::X509::Store to verify peer certificate.</p>
</li><li>
<p><code>:ssl_timeout</code> -The SSL timeout in seconds.</p>
</li></ul>
          

          
          <div class="method-source-code" id="ssl_options-3D-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 530</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">ssl_options=</span>(<span class="ruby-identifier">opts</span>={})
  <span class="ruby-ivar">@connection</span>   = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@ssl_options</span>  = <span class="ruby-identifier">opts</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- ssl_options-3D-source -->
          
        </div>

        

        
      </div><!-- ssl_options-3D-method -->

    
      <div id="method-c-timeout" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">timeout</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Gets the number of seconds after which requests to the REST API should time
out.</p>
          

          
          <div class="method-source-code" id="timeout-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 511</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">timeout</span>
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-ivar">@timeout</span>)
    <span class="ruby-ivar">@timeout</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">superclass</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Object</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">timeout</span>
    <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">timeout</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- timeout-source -->
          
        </div>

        

        
      </div><!-- timeout-method -->

    
      <div id="method-c-timeout-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">timeout=</span><span
            class="method-args">(timeout)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Sets the number of seconds after which requests to the REST API should time
out.</p>
          

          
          <div class="method-source-code" id="timeout-3D-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 505</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">timeout=</span>(<span class="ruby-identifier">timeout</span>)
  <span class="ruby-ivar">@connection</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@timeout</span> = <span class="ruby-identifier">timeout</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- timeout-3D-source -->
          
        </div>

        

        
      </div><!-- timeout-3D-method -->

    
      <div id="method-c-user" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">user</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Gets the user for REST HTTP authentication.</p>
          

          
          <div class="method-source-code" id="user-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 440</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">user</span>
  <span class="ruby-comment"># Not using superclass_delegating_reader. See +site+ for explanation</span>
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-ivar">@user</span>)
    <span class="ruby-ivar">@user</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">superclass</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Object</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">user</span>
    <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">user</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">freeze</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- user-source -->
          
        </div>

        

        
      </div><!-- user-method -->

    
      <div id="method-c-user-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">user=</span><span
            class="method-args">(user)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Sets the user for REST HTTP authentication.</p>
          

          
          <div class="method-source-code" id="user-3D-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 450</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">user=</span>(<span class="ruby-identifier">user</span>)
  <span class="ruby-ivar">@connection</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@user</span> = <span class="ruby-identifier">user</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- user-3D-source -->
          
        </div>

        

        
      </div><!-- user-3D-method -->

    
    </section><!-- public-class-method-details -->
  
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
      <h3 class="section-header">Public Instance Methods</h3>

    
      <div id="method-i-3D-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">==</span><span
            class="method-args">(other)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p><a href="../Test.html">Test</a> for equality.  Resource are equal if and
only if <code>other</code> is the same object or is an instance of the same
class, is not <code>new?</code>, and has the same <code>id</code>.</p>

<h4 id="method-i-3D-3D-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-identifier">ryan</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Ryan'</span>)
<span class="ruby-identifier">jamie</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Jamie'</span>)

<span class="ruby-identifier">ryan</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">jamie</span>
<span class="ruby-comment"># =&gt; false (Different name attribute and id)</span>

<span class="ruby-identifier">ryan_again</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Ryan'</span>)
<span class="ruby-identifier">ryan</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">ryan_again</span>
<span class="ruby-comment"># =&gt; false (ryan_again is new?)</span>

<span class="ruby-identifier">ryans_clone</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Ryan'</span>)
<span class="ruby-identifier">ryan</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">ryans_clone</span>
<span class="ruby-comment"># =&gt; false (Different id attributes)</span>

<span class="ruby-identifier">ryans_twin</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">id</span>)
<span class="ruby-identifier">ryan</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">ryans_twin</span>
<span class="ruby-comment"># =&gt; true</span>
</pre>
          

          
          <div class="method-source-code" id="3D-3D-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1107</span>
<span class="ruby-keyword">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">other</span>)
  <span class="ruby-identifier">other</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-keyword">self</span>) <span class="ruby-operator">||</span> (<span class="ruby-identifier">other</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">id</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">prefix_options</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">prefix_options</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- 3D-3D-source -->
          
        </div>

        

        
      </div><!-- 3D-3D-method -->

    
      <div id="method-i-clone" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">clone</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Returns a clone of the resource that hasn’t been assigned an
<code>id</code> yet and is treated as a new resource.</p>

<pre class="ruby"><span class="ruby-identifier">ryan</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>)
<span class="ruby-identifier">not_ryan</span> = <span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">clone</span>
<span class="ruby-identifier">not_ryan</span>.<span class="ruby-identifier">new?</span>  <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>Any active resource member attributes will NOT be cloned, though all other
attributes are.  This is to prevent the conflict between any
<code>prefix_options</code> that refer to the original parent resource and
the newly cloned parent resource that does not exist.</p>

<pre class="ruby"><span class="ruby-identifier">ryan</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>)
<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">address</span> = <span class="ruby-constant">StreetAddress</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value">1</span>, :<span class="ruby-identifier">person_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">id</span>)
<span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">hash</span> = {:<span class="ruby-keyword">not</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;an ARes instance&quot;</span>}

<span class="ruby-identifier">not_ryan</span> = <span class="ruby-identifier">ryan</span>.<span class="ruby-identifier">clone</span>
<span class="ruby-identifier">not_ryan</span>.<span class="ruby-identifier">new?</span>            <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-identifier">not_ryan</span>.<span class="ruby-identifier">address</span>         <span class="ruby-comment"># =&gt; NoMethodError</span>
<span class="ruby-identifier">not_ryan</span>.<span class="ruby-identifier">hash</span>            <span class="ruby-comment"># =&gt; {:not =&gt; &quot;an ARes instance&quot;}</span>
</pre>
          

          
          <div class="method-source-code" id="clone-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1029</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">clone</span>
  <span class="ruby-comment"># Clone all attributes except the pk and any nested ARes</span>
  <span class="ruby-identifier">cloned</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">primary_key</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">ActiveResource</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>)}.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>.<span class="ruby-identifier">clone</span>] }]
  <span class="ruby-comment"># Form the new resource - bypass initialize of resource with 'new' as that will call 'load' which</span>
  <span class="ruby-comment"># attempts to convert hashes into member objects and arrays into collections of objects.  We want</span>
  <span class="ruby-comment"># the raw objects to be cloned so we bypass load by directly setting the attributes hash.</span>
  <span class="ruby-identifier">resource</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span>({})
  <span class="ruby-identifier">resource</span>.<span class="ruby-identifier">prefix_options</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">prefix_options</span>
  <span class="ruby-identifier">resource</span>.<span class="ruby-identifier">send</span> <span class="ruby-value">:instance_variable_set</span>, <span class="ruby-string">'@attributes'</span>, <span class="ruby-identifier">cloned</span>
  <span class="ruby-identifier">resource</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- clone-source -->
          
        </div>

        

        
      </div><!-- clone-method -->

    
      <div id="method-i-destroy" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">destroy</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Deletes the resource from the remote service.</p>

<h4 id="method-i-destroy-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-identifier">my_id</span> = <span class="ruby-value">3</span>
<span class="ruby-identifier">my_person</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">my_id</span>)
<span class="ruby-identifier">my_person</span>.<span class="ruby-identifier">destroy</span>
<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">my_id</span>) <span class="ruby-comment"># 404 (Resource Not Found)</span>

<span class="ruby-identifier">new_person</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'James'</span>)
<span class="ruby-identifier">new_id</span> = <span class="ruby-identifier">new_person</span>.<span class="ruby-identifier">id</span> <span class="ruby-comment"># =&gt; 7</span>
<span class="ruby-identifier">new_person</span>.<span class="ruby-identifier">destroy</span>
<span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">new_id</span>) <span class="ruby-comment"># 404 (Resource Not Found)</span>
</pre>
          

          
          <div class="method-source-code" id="destroy-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1187</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">destroy</span>
  <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">element_path</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">headers</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- destroy-source -->
          
        </div>

        

        
      </div><!-- destroy-method -->

    
      <div id="method-i-dup" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">dup</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Duplicates the current resource without saving it.</p>

<h4 id="method-i-dup-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-identifier">my_invoice</span> = <span class="ruby-constant">Invoice</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">customer</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'That Company'</span>)
<span class="ruby-identifier">next_invoice</span> = <span class="ruby-identifier">my_invoice</span>.<span class="ruby-identifier">dup</span>
<span class="ruby-identifier">next_invoice</span>.<span class="ruby-identifier">new?</span> <span class="ruby-comment"># =&gt; true</span>

<span class="ruby-identifier">next_invoice</span>.<span class="ruby-identifier">save</span>
<span class="ruby-identifier">next_invoice</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">my_invoice</span> <span class="ruby-comment"># =&gt; false (different id attributes)</span>

<span class="ruby-identifier">my_invoice</span>.<span class="ruby-identifier">customer</span>   <span class="ruby-comment"># =&gt; That Company</span>
<span class="ruby-identifier">next_invoice</span>.<span class="ruby-identifier">customer</span> <span class="ruby-comment"># =&gt; That Company</span>
</pre>
          

          
          <div class="method-source-code" id="dup-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1134</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">dup</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">tap</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">resource</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">resource</span>.<span class="ruby-identifier">attributes</span>     = <span class="ruby-ivar">@attributes</span>
    <span class="ruby-identifier">resource</span>.<span class="ruby-identifier">prefix_options</span> = <span class="ruby-ivar">@prefix_options</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- dup-source -->
          
        </div>

        

        
      </div><!-- dup-method -->

    
      <div id="method-i-encode" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">encode</span><span
            class="method-args">(options={})</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Returns the serialized string representation of the resource in the
configured serialization format specified in <a
href="Base.html#method-c-format">::format</a>. The options applicable
depend on the configured encoding format.</p>
          

          
          <div class="method-source-code" id="encode-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1214</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">encode</span>(<span class="ruby-identifier">options</span>={})
  <span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;to_#{self.class.format.extension}&quot;</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- encode-source -->
          
        </div>

        

        
      </div><!-- encode-method -->

    
      <div id="method-i-eql-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">eql?</span><span
            class="method-args">(other)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Tests for equality (delegates to ==).</p>
          

          
          <div class="method-source-code" id="eql-3F-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1112</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">other</span>)
  <span class="ruby-keyword">self</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- eql-3F-source -->
          
        </div>

        

        
      </div><!-- eql-3F-method -->

    
      <div id="method-i-exists-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">exists?</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Evaluates to <code>true</code> if this resource is not <code>new?</code>
and is found on the remote service.  Using this method, you can check for
resources that may have been deleted between the object’s instantiation and
actions on it.</p>

<h4 id="method-i-exists-3F-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-constant">Person</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Theodore Roosevelt'</span>)
<span class="ruby-identifier">that_guy</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">first</span>)
<span class="ruby-identifier">that_guy</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-comment"># =&gt; true</span>

<span class="ruby-identifier">that_lady</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Paul Bean'</span>)
<span class="ruby-identifier">that_lady</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-comment"># =&gt; false</span>

<span class="ruby-identifier">guys_id</span> = <span class="ruby-identifier">that_guy</span>.<span class="ruby-identifier">id</span>
<span class="ruby-constant">Person</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">guys_id</span>)
<span class="ruby-identifier">that_guy</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-comment"># =&gt; false</span>
</pre>
          

          
          <div class="method-source-code" id="exists-3F-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1207</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exists?</span>
  <span class="ruby-operator">!</span><span class="ruby-identifier">new?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">to_param</span>, <span class="ruby-value">:params</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">prefix_options</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- exists-3F-source -->
          
        </div>

        

        
      </div><!-- exists-3F-method -->

    
      <div id="method-i-hash" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">hash</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Delegates to id in order to allow two resources of the same type and id to
work with something like:</p>

<pre class="ruby">[(<span class="ruby-identifier">a</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span> <span class="ruby-value">1</span>), (<span class="ruby-identifier">b</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span> <span class="ruby-value">2</span>)] &amp; [(<span class="ruby-identifier">c</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span> <span class="ruby-value">1</span>), (<span class="ruby-identifier">d</span> = <span class="ruby-constant">Person</span>.<span class="ruby-identifier">find</span> <span class="ruby-value">4</span>)] <span class="ruby-comment"># =&gt; [a]</span>
</pre>
          

          
          <div class="method-source-code" id="hash-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1118</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">hash</span>
  <span class="ruby-identifier">id</span>.<span class="ruby-identifier">hash</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- hash-source -->
          
        </div>

        

        
      </div><!-- hash-method -->

    
      <div id="method-i-id" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">id</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Gets the <code>\id</code> attribute of the resource.</p>
          

          
          <div class="method-source-code" id="id-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1076</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">id</span>
  <span class="ruby-identifier">attributes</span>[<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">primary_key</span>]
<span class="ruby-keyword">end</span></pre>
          </div><!-- id-source -->
          
        </div>

        

        
      </div><!-- id-method -->

    
      <div id="method-i-id-3D" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">id=</span><span
            class="method-args">(id)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Sets the <code>\id</code> attribute of the resource.</p>
          

          
          <div class="method-source-code" id="id-3D-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1081</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">id=</span>(<span class="ruby-identifier">id</span>)
  <span class="ruby-identifier">attributes</span>[<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">primary_key</span>] = <span class="ruby-identifier">id</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- id-3D-source -->
          
        </div>

        

        
      </div><!-- id-3D-method -->

    
      <div id="method-i-known_attributes" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">known_attributes</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>This is a list of known attributes for this resource. Either gathered from
the provided <code>schema</code>, or from the attributes set on this
instance after it has been fetched from the remote system.</p>
          

          
          <div class="method-source-code" id="known_attributes-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 986</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">known_attributes</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">known_attributes</span> <span class="ruby-operator">+</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">map</span>(&amp;<span class="ruby-value">:to_s</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- known_attributes-source -->
          
        </div>

        

        
      </div><!-- known_attributes-method -->

    
      <div id="method-i-load" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">load</span><span
            class="method-args">(attributes, remove_root = false)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>A method to manually load attributes from a hash. Recursively loads
collections of resources.  This method is called in <code>initialize</code>
and <code>create</code> when a hash of attributes is provided.</p>

<h4 id="method-i-load-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-identifier">my_attrs</span> = {:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'J&amp;J Textiles'</span>, :<span class="ruby-identifier">industry</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Cloth and textiles'</span>}
<span class="ruby-identifier">my_attrs</span> = {:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Marty'</span>, :<span class="ruby-identifier">colors</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-string">&quot;red&quot;</span>, <span class="ruby-string">&quot;green&quot;</span>, <span class="ruby-string">&quot;blue&quot;</span>]}

<span class="ruby-identifier">the_supplier</span> = <span class="ruby-constant">Supplier</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">first</span>)
<span class="ruby-identifier">the_supplier</span>.<span class="ruby-identifier">name</span> <span class="ruby-comment"># =&gt; 'J&amp;M Textiles'</span>
<span class="ruby-identifier">the_supplier</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">my_attrs</span>)
<span class="ruby-identifier">the_supplier</span>.<span class="ruby-identifier">name</span>(<span class="ruby-string">'J&amp;J Textiles'</span>)

<span class="ruby-comment"># These two calls are the same as Supplier.new(my_attrs)</span>
<span class="ruby-identifier">my_supplier</span> = <span class="ruby-constant">Supplier</span>.<span class="ruby-identifier">new</span>
<span class="ruby-identifier">my_supplier</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">my_attrs</span>)

<span class="ruby-comment"># These three calls are the same as Supplier.create(my_attrs)</span>
<span class="ruby-identifier">your_supplier</span> = <span class="ruby-constant">Supplier</span>.<span class="ruby-identifier">new</span>
<span class="ruby-identifier">your_supplier</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">my_attrs</span>)
<span class="ruby-identifier">your_supplier</span>.<span class="ruby-identifier">save</span>
</pre>
          

          
          <div class="method-source-code" id="load-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1254</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">load</span>(<span class="ruby-identifier">attributes</span>, <span class="ruby-identifier">remove_root</span> = <span class="ruby-keyword">false</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;expected an attributes Hash, got #{attributes.inspect}&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
  <span class="ruby-ivar">@prefix_options</span>, <span class="ruby-identifier">attributes</span> = <span class="ruby-identifier">split_options</span>(<span class="ruby-identifier">attributes</span>)

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
    <span class="ruby-identifier">remove_root</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">element_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">attributes</span> = <span class="ruby-constant">Formats</span>.<span class="ruby-identifier">remove_root</span>(<span class="ruby-identifier">attributes</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">remove_root</span>

  <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
    <span class="ruby-ivar">@attributes</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>] =
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">value</span>
        <span class="ruby-keyword">when</span> <span class="ruby-constant">Array</span>
          <span class="ruby-identifier">resource</span> = <span class="ruby-keyword">nil</span>
          <span class="ruby-identifier">value</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attrs</span><span class="ruby-operator">|</span>
            <span class="ruby-keyword">if</span> <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
              <span class="ruby-identifier">resource</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">find_or_create_resource_for_collection</span>(<span class="ruby-identifier">key</span>)
              <span class="ruby-identifier">resource</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">attrs</span>)
            <span class="ruby-keyword">else</span>
              <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">duplicable?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">attrs</span>
            <span class="ruby-keyword">end</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">when</span> <span class="ruby-constant">Hash</span>
          <span class="ruby-identifier">resource</span> = <span class="ruby-identifier">find_or_create_resource_for</span>(<span class="ruby-identifier">key</span>)
          <span class="ruby-identifier">resource</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>)
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">value</span>.<span class="ruby-identifier">duplicable?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">value</span>
      <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- load-source -->
          
        </div>

        

        
      </div><!-- load-method -->

    
      <div id="method-i-new-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new?</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Returns <code>true</code> if this object hasn’t yet been saved, otherwise,
returns <code>false</code>.</p>

<h4 id="method-i-new-3F-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-identifier">not_new</span> = <span class="ruby-constant">Computer</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">brand</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Apple'</span>, :<span class="ruby-identifier">make</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'MacBook'</span>, :<span class="ruby-identifier">vendor</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'MacMall'</span>)
<span class="ruby-identifier">not_new</span>.<span class="ruby-identifier">new?</span> <span class="ruby-comment"># =&gt; false</span>

<span class="ruby-identifier">is_new</span> = <span class="ruby-constant">Computer</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">brand</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'IBM'</span>, :<span class="ruby-identifier">make</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Thinkpad'</span>, :<span class="ruby-identifier">vendor</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'IBM'</span>)
<span class="ruby-identifier">is_new</span>.<span class="ruby-identifier">new?</span> <span class="ruby-comment"># =&gt; true</span>

<span class="ruby-identifier">is_new</span>.<span class="ruby-identifier">save</span>
<span class="ruby-identifier">is_new</span>.<span class="ruby-identifier">new?</span> <span class="ruby-comment"># =&gt; false</span>
</pre>
          

          
          <div class="method-source-code" id="new-3F-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1054</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">new?</span>
  <span class="ruby-operator">!</span><span class="ruby-identifier">persisted?</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- new-3F-source -->
          
        </div>

        
        <div class="aliases">
          Also aliased as: <a href="Base.html#method-i-new_record-3F">new_record?</a>
        </div>
        

        
      </div><!-- new-3F-method -->

    
      <div id="method-i-new_record-3F" class="method-detail method-alias">
        
        <div class="method-heading">
          <span class="method-name">new_record?</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
        </div>

        

        
        <div class="aliases">
          Alias for: <a href="Base.html#method-i-new-3F">new?</a>
        </div>
        
      </div><!-- new_record-3F-method -->

    
      <div id="method-i-persisted-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">persisted?</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Returns <code>true</code> if this object has been saved, otherwise returns
<code>false</code>.</p>

<h4 id="method-i-persisted-3F-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-identifier">persisted</span> = <span class="ruby-constant">Computer</span>.<span class="ruby-identifier">create</span>(:<span class="ruby-identifier">brand</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Apple'</span>, :<span class="ruby-identifier">make</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'MacBook'</span>, :<span class="ruby-identifier">vendor</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'MacMall'</span>)
<span class="ruby-identifier">persisted</span>.<span class="ruby-identifier">persisted?</span> <span class="ruby-comment"># =&gt; true</span>

<span class="ruby-identifier">not_persisted</span> = <span class="ruby-constant">Computer</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">brand</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'IBM'</span>, :<span class="ruby-identifier">make</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Thinkpad'</span>, :<span class="ruby-identifier">vendor</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'IBM'</span>)
<span class="ruby-identifier">not_persisted</span>.<span class="ruby-identifier">persisted?</span> <span class="ruby-comment"># =&gt; false</span>

<span class="ruby-identifier">not_persisted</span>.<span class="ruby-identifier">save</span>
<span class="ruby-identifier">not_persisted</span>.<span class="ruby-identifier">persisted?</span> <span class="ruby-comment"># =&gt; true</span>
</pre>
          

          
          <div class="method-source-code" id="persisted-3F-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1071</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">persisted?</span>
  <span class="ruby-ivar">@persisted</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- persisted-3F-source -->
          
        </div>

        

        
      </div><!-- persisted-3F-method -->

    
      <div id="method-i-reload" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">reload</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>A method to reload the attributes of this object from the remote web
service.</p>

<h4 id="method-i-reload-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-identifier">my_branch</span> = <span class="ruby-constant">Branch</span>.<span class="ruby-identifier">find</span>(:<span class="ruby-identifier">first</span>)
<span class="ruby-identifier">my_branch</span>.<span class="ruby-identifier">name</span> <span class="ruby-comment"># =&gt; &quot;Wislon Raod&quot;</span>

<span class="ruby-comment"># Another client fixes the typo...</span>

<span class="ruby-identifier">my_branch</span>.<span class="ruby-identifier">name</span> <span class="ruby-comment"># =&gt; &quot;Wislon Raod&quot;</span>
<span class="ruby-identifier">my_branch</span>.<span class="ruby-identifier">reload</span>
<span class="ruby-identifier">my_branch</span>.<span class="ruby-identifier">name</span> <span class="ruby-comment"># =&gt; &quot;Wilson Road&quot;</span>
</pre>
          

          
          <div class="method-source-code" id="reload-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1229</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">reload</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">to_param</span>, <span class="ruby-value">:params</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@prefix_options</span>).<span class="ruby-identifier">attributes</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- reload-source -->
          
        </div>

        

        
      </div><!-- reload-method -->

    
      <div id="method-i-respond_to-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">respond_to?</span><span
            class="method-args">(method, include_priv = false)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>A method to determine if an object responds to a message (e.g., a method
call). In Active Resource, a Person object with a <code>name</code>
attribute can answer <code>true</code> to
<code>my_person.respond_to?(:name)</code>,
<code>my_person.respond_to?(:name=)</code>, and
<code>my_person.respond_to?(:name?)</code>.</p>
          

          
          <div class="method-source-code" id="respond_to-3F-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1323</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">include_priv</span> = <span class="ruby-keyword">false</span>)
  <span class="ruby-identifier">method_name</span> = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-keyword">super</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">known_attributes</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">method_name</span>)
    <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">method_name</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r(?:=|\?)$/</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-node">$`</span>)
    <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-comment"># super must be called at the end of the method, because the inherited respond_to?</span>
    <span class="ruby-comment"># would return true for generated readers, even if the attribute wasn't present</span>
    <span class="ruby-keyword">super</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- respond_to-3F-source -->
          
        </div>

        
        <div class="aliases">
          Also aliased as: <a href="Base.html#method-i-respond_to_without_attributes-3F">respond_to_without_attributes?</a>
        </div>
        

        
      </div><!-- respond_to-3F-method -->

    
      <div id="method-i-respond_to_without_attributes-3F" class="method-detail method-alias">
        
        <div class="method-heading">
          <span class="method-name">respond_to_without_attributes?</span><span
            class="method-args">(method, include_priv = false)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>For checking <code>respond_to?</code> without searching the attributes
(which is faster).</p>
          

          
        </div>

        

        
        <div class="aliases">
          Alias for: <a href="Base.html#method-i-respond_to-3F">respond_to?</a>
        </div>
        
      </div><!-- respond_to_without_attributes-3F-method -->

    
      <div id="method-i-save" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">save</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Saves (<code>POST</code>) or updates (<code>PUT</code>) a resource. 
Delegates to <code>create</code> if the object is new, <code>update</code>
if it exists. If the response to the save includes a body, it will be
assumed that this body is Json for the final object as it looked after the
save (which would include attributes like <code>created_at</code> that
weren’t part of the original submit).</p>

<h4 id="method-i-save-label-Examples">Examples</h4>

<pre class="ruby"><span class="ruby-identifier">my_company</span> = <span class="ruby-constant">Company</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'RoleModel Software'</span>, :<span class="ruby-identifier">owner</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'Ken Auer'</span>, :<span class="ruby-identifier">size</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">2</span>)
<span class="ruby-identifier">my_company</span>.<span class="ruby-identifier">new?</span> <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-identifier">my_company</span>.<span class="ruby-identifier">save</span> <span class="ruby-comment"># sends POST /companies/ (create)</span>

<span class="ruby-identifier">my_company</span>.<span class="ruby-identifier">new?</span> <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-identifier">my_company</span>.<span class="ruby-identifier">size</span> = <span class="ruby-value">10</span>
<span class="ruby-identifier">my_company</span>.<span class="ruby-identifier">save</span> <span class="ruby-comment"># sends PUT /companies/1 (update)</span>
</pre>
          

          
          <div class="method-source-code" id="save-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1154</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">save</span>
  <span class="ruby-identifier">new?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">create</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">update</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- save-source -->
          
        </div>

        

        
      </div><!-- save-method -->

    
      <div id="method-i-save-21" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">save!</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Saves the resource.</p>

<p>If the resource is new, it is created via <code>POST</code>, otherwise the
existing resource is updated via <code>PUT</code>.</p>

<p>With <code>save!</code> validations always run. If any of them fail
ActiveResource::ResourceInvalid gets raised, and nothing is POSTed to the
remote system. See <a
href="Validations.html">ActiveResource::Validations</a> for more
information.</p>

<p>There’s a series of callbacks associated with <code>save!</code>. If any of
the <code>before_*</code> callbacks return <code>false</code> the action is
cancelled and <code>save!</code> raises ActiveResource::ResourceInvalid.</p>
          

          
          <div class="method-source-code" id="save-21-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1171</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">save!</span>
  <span class="ruby-identifier">save</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">raise</span>(<span class="ruby-constant">ResourceInvalid</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>))
<span class="ruby-keyword">end</span></pre>
          </div><!-- save-21-source -->
          
        </div>

        

        
      </div><!-- save-21-method -->

    
      <div id="method-i-schema" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">schema</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>If no schema has been defined for the class (see
<code>ActiveResource::schema=</code>), the default automatic schema is
generated from the current instance’s attributes</p>
          

          
          <div class="method-source-code" id="schema-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 979</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">schema</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">schema</span> <span class="ruby-operator">||</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">attributes</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- schema-source -->
          
        </div>

        

        
      </div><!-- schema-method -->

    
      <div id="method-i-to_json" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">to_json</span><span
            class="method-args">(options={})</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="to_json-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1338</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_json</span>(<span class="ruby-identifier">options</span>={})
  <span class="ruby-keyword">super</span>({ <span class="ruby-value">:root</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">element_name</span> }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>))
<span class="ruby-keyword">end</span></pre>
          </div><!-- to_json-source -->
          
        </div>

        

        
      </div><!-- to_json-method -->

    
      <div id="method-i-to_xml" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">to_xml</span><span
            class="method-args">(options={})</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="to_xml-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1342</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_xml</span>(<span class="ruby-identifier">options</span>={})
  <span class="ruby-keyword">super</span>({ <span class="ruby-value">:root</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">element_name</span> }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>))
<span class="ruby-keyword">end</span></pre>
          </div><!-- to_xml-source -->
          
        </div>

        

        
      </div><!-- to_xml-method -->

    
      <div id="method-i-update_attribute" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">update_attribute</span><span
            class="method-args">(name, value)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Updates a single attribute and then saves the object.</p>

<p>Note: Unlike <a
href="../ActiveRecord/Persistence.html#method-i-update_attribute">ActiveRecord::Persistence#update_attribute</a>,
this method <strong>is</strong> subject to normal validation routines as an
update sends the whole body of the resource in the request.  (See <a
href="Validations.html">Validations</a>).</p>

<p>As such, this method is equivalent to calling <a
href="Base.html#method-i-update_attributes">#update_attributes</a> with a
single attribute/value pair.</p>

<p>If the saving fails because of a connection or remote service error, an
exception will be raised.  If saving fails because the resource is invalid
then <code>false</code> will be returned.</p>
          

          
          <div class="method-source-code" id="update_attribute-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1298</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update_attribute</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{name}=&quot;</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-identifier">value</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">save</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- update_attribute-source -->
          
        </div>

        

        
      </div><!-- update_attribute-method -->

    
      <div id="method-i-update_attributes" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">update_attributes</span><span
            class="method-args">(attributes)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Updates this resource with all the attributes from the passed-in <a
href="../Hash.html">Hash</a> and requests that the record be saved.</p>

<p>If the saving fails because of a connection or remote service error, an
exception will be raised.  If saving fails because the resource is invalid
then <code>false</code> will be returned.</p>

<p>Note: Though this request can be made with a partial set of the resource’s
attributes, the full body of the request will still be sent in the save
request to the remote service.</p>
          

          
          <div class="method-source-code" id="update_attributes-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1313</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update_attributes</span>(<span class="ruby-identifier">attributes</span>)
  <span class="ruby-identifier">load</span>(<span class="ruby-identifier">attributes</span>, <span class="ruby-keyword">false</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">save</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- update_attributes-source -->
          
        </div>

        

        
      </div><!-- update_attributes-method -->

    
    </section><!-- public-instance-method-details -->
  
     <section id="protected-instance-5Buntitled-5D-method-details" class="method-section section">
      <h3 class="section-header">Protected Instance Methods</h3>

    
      <div id="method-i-collection_path" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">collection_path</span><span
            class="method-args">(options = nil)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="collection_path-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1388</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">collection_path</span>(<span class="ruby-identifier">options</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">collection_path</span>(<span class="ruby-identifier">options</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">prefix_options</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- collection_path-source -->
          
        </div>

        

        
      </div><!-- collection_path-method -->

    
      <div id="method-i-connection" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">connection</span><span
            class="method-args">(refresh = false)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="connection-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1347</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">connection</span>(<span class="ruby-identifier">refresh</span> = <span class="ruby-keyword">false</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">connection</span>(<span class="ruby-identifier">refresh</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- connection-source -->
          
        </div>

        

        
      </div><!-- connection-method -->

    
      <div id="method-i-create" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">create</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Create (i.e., save to the remote service) the new resource.</p>
          

          
          <div class="method-source-code" id="create-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1359</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create</span>
  <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">post</span>(<span class="ruby-identifier">collection_path</span>, <span class="ruby-identifier">encode</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">headers</span>).<span class="ruby-identifier">tap</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">id</span> = <span class="ruby-identifier">id_from_response</span>(<span class="ruby-identifier">response</span>)
    <span class="ruby-identifier">load_attributes_from_response</span>(<span class="ruby-identifier">response</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- create-source -->
          
        </div>

        

        
      </div><!-- create-method -->

    
      <div id="method-i-element_path" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">element_path</span><span
            class="method-args">(options = nil)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="element_path-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1380</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">element_path</span>(<span class="ruby-identifier">options</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">element_path</span>(<span class="ruby-identifier">to_param</span>, <span class="ruby-identifier">options</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">prefix_options</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- element_path-source -->
          
        </div>

        

        
      </div><!-- element_path-method -->

    
      <div id="method-i-id_from_response" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">id_from_response</span><span
            class="method-args">(response)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Takes a response from a typical create post and pulls the ID out</p>
          

          
          <div class="method-source-code" id="id_from_response-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1376</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">id_from_response</span>(<span class="ruby-identifier">response</span>)
  <span class="ruby-identifier">response</span>[<span class="ruby-string">'Location'</span>][<span class="ruby-regexp">%r\/([^\/]*?)(\.\w+)?$/</span>, <span class="ruby-value">1</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span>[<span class="ruby-string">'Location'</span>]
<span class="ruby-keyword">end</span></pre>
          </div><!-- id_from_response-source -->
          
        </div>

        

        
      </div><!-- id_from_response-method -->

    
      <div id="method-i-load_attributes_from_response" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">load_attributes_from_response</span><span
            class="method-args">(response)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="load_attributes_from_response-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1366</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">load_attributes_from_response</span>(<span class="ruby-identifier">response</span>)
  <span class="ruby-keyword">if</span> (<span class="ruby-identifier">response_code_allows_body?</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">code</span>) <span class="ruby-operator">&amp;&amp;</span>
      (<span class="ruby-identifier">response</span>[<span class="ruby-string">'Content-Length'</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">response</span>[<span class="ruby-string">'Content-Length'</span>] <span class="ruby-operator">!=</span> <span class="ruby-string">&quot;0&quot;</span>) <span class="ruby-operator">&amp;&amp;</span>
      <span class="ruby-operator">!</span><span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>)
    <span class="ruby-identifier">load</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">format</span>.<span class="ruby-identifier">decode</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>), <span class="ruby-keyword">true</span>)
    <span class="ruby-ivar">@persisted</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- load_attributes_from_response-source -->
          
        </div>

        

        
      </div><!-- load_attributes_from_response-method -->

    
      <div id="method-i-new_element_path" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new_element_path</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          
          

          
          <div class="method-source-code" id="new_element_path-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1384</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">new_element_path</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new_element_path</span>(<span class="ruby-identifier">prefix_options</span>)
<span class="ruby-keyword">end</span></pre>
          </div><!-- new_element_path-source -->
          
        </div>

        

        
      </div><!-- new_element_path-method -->

    
      <div id="method-i-update" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">update</span><span
            class="method-args">()</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Update the resource on the remote service.</p>
          

          
          <div class="method-source-code" id="update-source">
            <pre><span class="ruby-comment"># File /usr/local/lib/ruby/gems/1.9.1/gems/activeresource-3.2.7/lib/active_resource/base.rb, line 1352</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update</span>
  <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">put</span>(<span class="ruby-identifier">element_path</span>(<span class="ruby-identifier">prefix_options</span>), <span class="ruby-identifier">encode</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">headers</span>).<span class="ruby-identifier">tap</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">load_attributes_from_response</span>(<span class="ruby-identifier">response</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- update-source -->
          
        </div>

        

        
      </div><!-- update-method -->

    
    </section><!-- protected-instance-method-details -->
  
  </section><!-- 5Buntitled-5D -->

</div><!-- documentation -->


<footer id="validator-badges">
  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
</footer>

